Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: Unescaping ASP vbscript escaped string

Thread Tools

Re: Unescaping ASP vbscript escaped string

Vance Kessler
Posts: n/a
The solution is to use JScript unescape function. Like this:

using Microsoft.JScript;
System.Web.HttpCookie oCookie = Request.Cookies["<NameOfCookieDomain>"];
string sEscapedValue = oCookie.Values["<NameOfCookie>"];
string sValue = Server.UrlDecode(sEscapedValue);
sValue = Microsoft.JScript.GlobalObject.unescape(sValue); Removed) (Vance Kessler) wrote in message news:<(E-Mail Removed) om>...
> We are trying write a new ASP.NET page to work with an existing
> stateless ASP application. The ASP application creates a cookie and
> of course stores the cookie values as escaped strings (using the
> vbscript escape function). I am have a terrible time 'unescaping'
> that string with C# under ASP.NET.
> I have tried the following:
> HttpUtility.UrlDecode
> HttpUtility.HtmlDecode (this should not work but I tried it)
> System.Web.HttpContext.Current.Server.UrlDecode
> System.Web.HttpContext.Current.Server.HtmlDecode (tried this too)
> They all return the same string back or a slightly unescaped version.
> Is there something about the way VBScript's escape works that is not
> compatible with UrlDecode? Is there something about accessing this
> through HttpCookie that changes things? Will I have to write my own
> function to decode this or is there some other functions I can access
> that will do this?
> Thanks

Reply With Quote

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unescaping Unicode code points in a Java string Greg Java 7 05-17-2011 12:29 AM
Unescaping hex encoded characters in string? sprite Ruby 2 09-02-2010 08:52 PM
How to convert Unicode string to raw string escaped with HTML Entities ldng Python 3 05-10-2007 09:37 AM
Dequote a string, unescaping escaped quotes Jonny C Programming 7 12-20-2005 03:36 AM
convert string to the "escaped string" Petr Jakes Python 3 11-12-2005 05:32 PM