473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ASP vs. ASP.NET: Escapable chars in cookie name?

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!
Nov 18 '05 #1
0 1210

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Denna | last post by:
Hello, I'm having a little trouble with cookies, I can write one when I press a button using the following code:- HttpCookie myCookie = new HttpCookie("MyTestCookie"); myCookie.Value =...
3
by: collie | last post by:
I have a project that contains asp and .net. ..NET is supposed to receive a cookie from classic ASP. The problem is that my aspx page doesn't seem to recognise the cookie that it's supposed to...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
11
by: Keith Patrick | last post by:
Could someone explain to me the relationship between these two classes? I am ripping my hair out trying to divert an HttpRequest to a new location via an HttpWebRequest, but I cannot get my...
1
by: Tod Birdsall, MCSD for .NET | last post by:
Hi All, I have two ASP.NET applications which I am trying to have share forms authentication. But I am running into problems. App A is an ASP.NET 2.0 Beta 2 application. App B is an ASP.NET...
1
by: CR1 | last post by:
I found a great cookie script below, but don't know how to make it also pass the values sent to the cookie, to a querystring as well for tracking purposes. Can anyone help? If there was a way to...
6
by: kelvlam | last post by:
Hello all, I'm still a bit new with JavaScript, and I hope the guru here can shed some light for me. It's regarding handling cookie and the case-sensitive nature of JavaScript itself. My...
13
by: Goofy | last post by:
Does anyone know how I can kill a session by session ID ? -- Goofy
0
by: shamirza | last post by:
· What is view state and use of it? The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.