S
SL
Hi all...
I am currently porting an application from ASP to ASP.NET.
I seem to be experiencing different behavior when issuing cookies in
ASP.NET vs. what I experienced in ASP.
The name of my cookie contains underscore characters ("_"). In
theory, if I use my original ASP application to set the cookie, and
then use the ASP.NET application to set the cookie, the ASP.NET
application should be overwriting the cookie set by the ASP
application (i.e. I should end up with only one cookie). Instead, I
end up with two seperate cookies.
When I view the browser cookies by issuing the URL
"javascript:alert(document.cookie)" to the browser, for some reason
the underscores in the name of the cookie created in ASP show up as
escaped characters, i.e. as %5F, whereas the underscores in the name
of the cookie created with ASP.NET actually show up as underscores.
For example, "%5FMY%5FCOOKIE%5F" vs. "_MY_COOKIE_".
Does anyone know what might be causing this discrepency and how I can
make ASP.NET behave as ASP did in this regard?
Here is my ASP code...
CookieName = "_MY_COOKIE_"
Response.Cookies(CookieName).Domain = strDomainName
Response.Cookies(CookieName).Path = "/"
Response.Cookies(CookieName).Secure = True
Response.Cookies(CookieName) = strCookiePayload
Here is my ASP.NET code (using C#)
cookieName = "_MY_COOKIE_";
Response.Cookies[cookieName].Domain = strDomainName;
Response.Cookies[cookieName].Path = "/";
Response.Cookies[cookieName].Secure = true;
Response.Cookies[cookieName].Value = strCookiePayload;
Any help would be greatly appreciated. Thanks!
I am currently porting an application from ASP to ASP.NET.
I seem to be experiencing different behavior when issuing cookies in
ASP.NET vs. what I experienced in ASP.
The name of my cookie contains underscore characters ("_"). In
theory, if I use my original ASP application to set the cookie, and
then use the ASP.NET application to set the cookie, the ASP.NET
application should be overwriting the cookie set by the ASP
application (i.e. I should end up with only one cookie). Instead, I
end up with two seperate cookies.
When I view the browser cookies by issuing the URL
"javascript:alert(document.cookie)" to the browser, for some reason
the underscores in the name of the cookie created in ASP show up as
escaped characters, i.e. as %5F, whereas the underscores in the name
of the cookie created with ASP.NET actually show up as underscores.
For example, "%5FMY%5FCOOKIE%5F" vs. "_MY_COOKIE_".
Does anyone know what might be causing this discrepency and how I can
make ASP.NET behave as ASP did in this regard?
Here is my ASP code...
CookieName = "_MY_COOKIE_"
Response.Cookies(CookieName).Domain = strDomainName
Response.Cookies(CookieName).Path = "/"
Response.Cookies(CookieName).Secure = True
Response.Cookies(CookieName) = strCookiePayload
Here is my ASP.NET code (using C#)
cookieName = "_MY_COOKIE_";
Response.Cookies[cookieName].Domain = strDomainName;
Response.Cookies[cookieName].Path = "/";
Response.Cookies[cookieName].Secure = true;
Response.Cookies[cookieName].Value = strCookiePayload;
Any help would be greatly appreciated. Thanks!