Solved

overwrite cookie

Posted on 2004-08-17
7
1,272 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 500 total points
Comment Utility
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
Comment Utility
nope.. keeps the same value...
0
 

Author Comment

by:testn1
Comment Utility
i'm trying to overwrite it, it already exists... even if i recreate it, keep the same value
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:testn1
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now