Click here to Skip to main content
14,838,597 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can i store the cookies by using ASP.NET and retrieve the cookie value by using ASP?

my ASP.NET (store)
C#
HttpCookie _userInfoCookies = new HttpCookie("userInfo");
_userInfoCookies["Name"] = "Michael";
Response.Cookies.Add(_userInfoCookies);


My ASP (retrieve)
C#
<%
 name = Request.Cookies("Name")
 Response.Write("Cookies Name=" & name)
%>


but it's not working. any advice?
Posted
Comments
Thanks7872 8-Oct-13 4:58am
   
What do you mean by not working

1 solution

C#
HttpCookie _userInfoCookies = new HttpCookie("userInfo");
_userInfoCookies["Name"] = "Michael";
Response.Cookies.Add(_userInfoCookies);
Response.Redirect("YourPageName.aspx");

when you are retrieving cookie suppose on pageload then call like
C#
string s = Request.Cookies["userInfo"].Value;
   
v2
Comments
melvintcs 8-Oct-13 20:14pm
   
i able to store and retrieve by using only ASP.NET, but now i want to retrieve in ASP, not ASP.NET C#

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900