ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Lose your application development headaches. Start developing and deploying applications with Advantage Database Server today. Download a 30-day trial for Free!
  #1  
Old March 26th, 2008, 02:17 PM
pfefferc pfefferc is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 5 pfefferc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 36 sec
Reputation Power: 0
ASP Cookie

When setting a cookie with asp, the underscore is being replaced by %5F. Does anyone know a way around it:

For Each x in Request.Cookies
Response.Write("<p>")
If Request.Cookies(x).HasKeys Then
For Each y in Request.Cookies(x)
Response.Write(x & ":" & y & "=" & Request.Cookies(x)(y))
Response.Write("<br />")
Next
Else
Response.Write(x & "=" & Request.Cookies(x) & "<br />")
strString = Replace(x, "%5F", "_")
Response.Write(strString & "<br />")
Response.Cookies(strString) = ""
' Response.Cookies(strString).Domain = ".domain.com"
' Response.Cookies(strString).Expires = Date() - 1
Response.Write(strString & "=" & Request.Cookies(strString) & "<br /><br />")
End If
Response.Write "</p>"
Next

Reply With Quote
  #2  
Old March 26th, 2008, 05:20 PM
icywave icywave is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Sep 2005
Location: Global Village
Posts: 687 icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 21 h 31 m 53 sec
Reputation Power: 31
Send a message via MSN to icywave
You DON'T want that right?

Change:
Code:
strString = Replace(x, "%5F", "_")


To:
Code:
strString = x

Reply With Quote
  #3  
Old March 26th, 2008, 10:34 PM
soft903's Avatar
soft903 soft903 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 147 soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 m 12 sec
Reputation Power: 55
Hi,

Can you post the output of the code ?
As I don't get any "%5F" for underscore.

Reply With Quote
  #4  
Old March 27th, 2008, 07:12 AM
pfefferc pfefferc is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 5 pfefferc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 36 sec
Reputation Power: 0
No, I want the cookie to have the underscore, not the %5F. When outputting it to the screen, it appears as the underscore. However, when looking at the cookie after it has been set in Firefox, the underscore is changed to %5F. I know Firefox can accept the underscore because I have other cookies that have it. That's why I tried the
Code:
strString = Replace(x, "%5F", "_")


Thanks,

Reply With Quote
  #5  
Old March 27th, 2008, 09:52 AM
icywave icywave is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Sep 2005
Location: Global Village
Posts: 687 icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 21 h 31 m 53 sec
Reputation Power: 31
Send a message via MSN to icywave
Please show us the code you are using to set the cookie.

Reply With Quote
  #6  
Old March 27th, 2008, 11:52 AM
pfefferc pfefferc is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 5 pfefferc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 36 sec
Reputation Power: 0
The cookie is set by another server. (A log in server) I just need to delete the cookie so it logs the user off. Not sure how they are setting it.

Reply With Quote
  #7  
Old March 27th, 2008, 04:59 PM
icywave icywave is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Sep 2005
Location: Global Village
Posts: 687 icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 21 h 31 m 53 sec
Reputation Power: 31
Send a message via MSN to icywave
Quote:
When setting a cookie with asp, the underscore is being replaced by %5F. Does anyone know a way around it:


This can only be achieved if you are actually setting the Cookies...

Quote:
The cookie is set by another server. (A log in server) I just need to delete the cookie so it logs the user off. Not sure how they are setting it.


Since you're not even setting the cookies, there's no way you can determine how the cookies are filtered. However you can replace them back like you already did. To delete a Cookie, just set the Cookie to nothing or set it to expire now. It seems to me like you got everything under control, what is your problem?

Code:
For Each x in Request.Cookies
Response.Write("<p>")
If Request.Cookies(x).HasKeys Then
For Each y in Request.Cookies(x)
Response.Write(x & ":" & y & "=" & Request.Cookies(x)(y))
Response.Write("<br />")
Next
Else
Response.Write(x & "=" & Request.Cookies(x) & "<br />")
strString = Replace(x, "%5F", "_")
Response.Write(strString & "<br />")
Response.Cookies(strString) = ""
' Response.Cookies(strString).Domain = ".domain.com"
' Response.Cookies(strString).Expires = Date() - 1
Response.Write(strString & "=" & Request.Cookies(strString) & "<br /><br />")
End If
Response.Write "</p>"
Next

Reply With Quote
  #8  
Old March 27th, 2008, 06:50 PM
pfefferc pfefferc is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 5 pfefferc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 36 sec
Reputation Power: 0
Question

The cookie that is being set is say:

_the_cookie

When I try to delete it, it sets it as

%5Fthe%5Fcookie

I need a way to delete _the_cookie, but I can't because it is creating a new cookie instead.

Reply With Quote
  #9  
Old March 27th, 2008, 07:07 PM
icywave icywave is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Sep 2005
Location: Global Village
Posts: 687 icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level)icywave User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 21 h 31 m 53 sec
Reputation Power: 31
Send a message via MSN to icywave
Try this:
Code:
For Each x in Request.Cookies
Response.Write("<p>")
If Request.Cookies(x).HasKeys Then
For Each y in Request.Cookies(x)
Response.Write(x & ":" & y & "=" & Request.Cookies(x)(y))
Response.Write("<br />")
Next
Else
Response.Write(x & "=" & Request.Cookies(x) & "<br />")
strString = Replace(x, "%5F", "_")
Response.Write(strString & "<br />")
Response.Cookies(strString) = ""
' Response.Cookies(strString).Domain = ".domain.com"
Response.Cookies(strString).Expires = Date() - 1
Response.Write(strString & "=" & Request.Cookies(strString) & "<br /><br />")
End If
Response.Write "</p>"
Next

Reply With Quote
  #10  
Old March 27th, 2008, 08:34 PM
soft903's Avatar
soft903 soft903 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 147 soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level)soft903 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 m 12 sec
Reputation Power: 55
Hi,

As the cookies are not set by you, there maybe more similar case for other special characters. e.g. @%&^

I would suggest you use unescape
Code:
strString = unescape(x)

Hope it helps

Reply With Quote
  #11  
Old March 28th, 2008, 07:09 AM
pfefferc pfefferc is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 5 pfefferc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 36 sec
Reputation Power: 0
Tried both suggestions, same results. Any other ideas?

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > ASP Cookie


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |