?
Solved

overwrite cookie

Posted on 2004-08-17
7
Medium Priority
?
1,303 Views
Last Modified: 2012-06-21
need help, this is not overwriting the cookie value...

Response.Cookies("ID").Value = ID   ....

0
Comment
Question by:testn1
7 Comments
 
LVL 25

Accepted Solution

by:
nauman_ahmed earned 2000 total points
ID: 11820529
Try this:

If (Request.Cookies("ID") != null)
{
  HttpCookie ck = new HttpCookie("ID",Request.Cookies("ID"));
  //Set expiration time.
  Response.Cookies.Add(ck);
}

Best, Nauman
0
 

Author Comment

by:testn1
ID: 11820573
nope.. keeps the same value...
0
 

Author Comment

by:testn1
ID: 11820589
i'm trying to overwrite it, it already exists... even if i recreate it, keep the same value
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:testn1
ID: 11820594
and even if i expire it : Response.Cookies("webFASBizID").Expires = DateTime.Today.AddDays(-1)

still exists with the value
0
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 11820741
Have a look at the following article that best describes about cookie. Also its not good to just expire cookie by DateTime.Today.AddDays(-1). Use DateTime.Today.AddYears(-30) so that it will be expired no matter what time difference is there.

URL: http://www.codeproject.com/aspnet/AspNetCookies.asp?df=100&forumid=13312&exp=0&select=638073

Best, Nauman
0
 
LVL 8

Expert Comment

by:shovavnik
ID: 11820866
Are you running both asp and asp.net together?

If so, keep in mind that they do not automatically share their cookies.  asp.net cannot automatically use cookies set in asp.  You can add the following line to your Page_Load method:
Response.Cookies.Set( Request.Cookies.Get( "MY_COOKIE" ));
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 11820903
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Integration Management Part 2
Loops Section Overview
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question