tags:

views:

19

answers:

1

Hi,

I want in Session_Start method check if cookie with specific key exists and if not create cookie with this key.

if (Request.Cookies[key] == null)

{

SetCookie();

}

But in Session_Start it is always NULL. If check it in another place I get cookie's value.

Why is it always NULL in Session_Start?

Thanks,

Raya

A: 

Is the cookie set with an expiration date?

If not the cookie is for the session only and if you close the browser it will disappear.

David Mårtensson
Yes, I set with an expiration date. It is Null only in Session_Start.If I access to this cookie from another place I recieve the right value.