Hi,
I haven't used cookies before so I'm probably misunderstanding some very basic things here. Because what I have is not working. The cookie I try to read is empty. I thought all I'd have to do to is something like this in the web part where I want to write out to a cookie (Please see code below. )
I know I read a post on here about a cookie collection etc.. and it seemed like a lot of overkill. So I don't know what I'm missing here. Also what infrastructure exists to look at cookies etc... - seems like you can't just navigate to a directory and see them. I feel really dumb about all this. Thanks for any help or pointers.
protected override void Render(writer)
{
.
.
HttpCookie aCookie - new HttpCookie("saveobject");
aCookie.Value = saveobject;
aCookie.Expires = DateTime.Now.AddDays(1);
Page.Response.Cookies.Add(aCookie);
}
then in the sharepoint page where I want to use the cookie value the web part code is:
in a preRender override
if(Page.Request.Cookies[saveobject] != null)
{
string saveobj = Page.Request.Cookies["saveobj"].ToString();
}