Welcome to MSDN Blogs Sign in | Join | Help

Cookies in X++

Cookies are often used in web applications to maintain some data on the browser machine and sent back to the server everytime across multiple page visits from the same site/domain untill it expires.

The user can set the browser option to accept cookies or not. So before using cookies,  these considerations along with other security and privacy considerations should be carefully thoughout.

EP framework provides way to read and write cookies from X++ code  executed by EP. Below is a sample code snippet to read and write cookie in X++ 

IISRequest r;
;

//Write Cookie with a set expiration date 
webSession().response().cookies().itemWriteCookie("CustomerName=mey; expires=Fri, 31-Dec-2010 23:59:59 GMT");

//Read cookie from the Request object
r = new IISRequest();
webSession().writeTxt(r.cookies().itemTxt(("customerName")));

 

Published Friday, September 28, 2007 8:46 AM by meysun

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Techy News Blog » Cookies in X++

Friday, September 28, 2007 4:13 AM by Techy News Blog » Cookies in X++

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker