goodluck11
asked on
accessing cookies from different aspx/asp pages not working
c# creating cookie
System.Web.HttpCookie UserNameCookie = new System.Web.HttpCookie("Use rName");
UserNameCookie.Value = objUser.Username;
UserNameCookie.Expires = DateTime.Now.AddDays(5);
Response.Cookies.Add(UserN ameCookie) ;
Classic ASP - reading cookie
Dim strUsername
strUsername = Request.Cookies("UserName" )
response.write strUsername
response.end
it used to work, not anymore, how can we find the actual cookie value ?
System.Web.HttpCookie UserNameCookie = new System.Web.HttpCookie("Use
UserNameCookie.Value = objUser.Username;
UserNameCookie.Expires = DateTime.Now.AddDays(5);
Response.Cookies.Add(UserN
Classic ASP - reading cookie
Dim strUsername
strUsername = Request.Cookies("UserName"
response.write strUsername
response.end
it used to work, not anymore, how can we find the actual cookie value ?
Are the setting and getting both done on the same path and of not is the path set correctly?
http://msdn.microsoft.com/en-us/library/ms524757(v=vs.90).aspx
Path
Write-only. If specified, the Cookie is sent only to requests to this path. If this attribute is not set, the application path is used.
<%
Response.Cookies("Type") = "Chocolate Chip"
Response.Cookies("Type").E xpires = "July 31, 2012"
Response.Cookies("Type").P ath = "/" ' cookie available to all folders
%>
http://msdn.microsoft.com/en-us/library/ms524757(v=vs.90).aspx
Path
Write-only. If specified, the Cookie is sent only to requests to this path. If this attribute is not set, the application path is used.
<%
Response.Cookies("Type") = "Chocolate Chip"
Response.Cookies("Type").E
Response.Cookies("Type").P
%>
ASKER
we will try that. is path always required when writing cookies ?
will the ASP code be able to read the cookies and know where they are located after specifying the path / ?
will the ASP code be able to read the cookies and know where they are located after specifying the path / ?
depends what MS means by If this attribute is not set, the application path is used.
So have a look if you changed path from the time it worked
So have a look if you changed path from the time it worked
ASKER
We did tried, it works if on the same server, didn't work if on localhost or separate server
Dont know if the change took effect or not because this is on DNN, they tell us that only changing the .cs file and uploading only the .cs change should apply changes. Doesn't dotnet applications need the dlls re-compiled for all the code to take effect ?
It would work or not depending on the compilation/upload process...confused...
Dont know if the change took effect or not because this is on DNN, they tell us that only changing the .cs file and uploading only the .cs change should apply changes. Doesn't dotnet applications need the dlls re-compiled for all the code to take effect ?
It would work or not depending on the compilation/upload process...confused...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
oh so we cannot set a cookie on www.domain1.com and read it on the server hosting www.domain2.com ?
ASKER
arent the cookies on the client side ? browser reads them locally ?
Cookies can be set client and server side but whichever sets them has to be on the same domain as the page reading them
ASKER
<%
dim intPollID
intPollID=19
Response.Cookies("PollId")
Response.Cookies("PollId")
dim sval
sval= Request.Cookies("PollID")
response.write sval
response.end