How to get Cookie value in Global.asax

Posted by Mdjack under ASP.NET on 9/24/2012 | Points: 10 | Views : 6415 | Status : [Member] | Replies : 4
Hi Friends,

How to get the Cookie value in Global.asax Session_end() event

N. MOHAMED ZACKKARIAH


Responses

Posted by: Jpchoudhari on: 9/24/2012 [Member] Starter | Points: 25

Up
0
Down
u can access cookie collection with HttpContext.Current.Request.Cookies to read and HttpContext.Current.Response.Cookies to set values

Kind Regards,
Jay

Mdjack, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mdjack on: 9/24/2012 [Member] Starter | Points: 25

Up
0
Down
When i use that code. The Object reference set to the null exception thrown by code

N. MOHAMED ZACKKARIAH

Mdjack, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Navadeebans on: 9/24/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

try with the below syntax,
string strTest=Context.Request.Cookies["Name"].Value;

Regards,
Nava Deeban S

Mdjack, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jpchoudhari on: 9/24/2012 [Member] Starter | Points: 25

Up
0
Down
first try to check whether you are getting null request object or what and then check for non-empty cookies collection

Kind Regards,
Jay

Mdjack, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response