Re: Unescaping ASP vbscript escaped string

Discussion in 'ASP .Net' started by Vance Kessler, Mar 1, 2004.

  1. 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);


    (Vance Kessler) wrote in message news:<>...
    > 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
     
    Vance Kessler, Mar 1, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel

    unescaping xml escape codes

    Daniel, Aug 10, 2003, in forum: Python
    Replies:
    2
    Views:
    5,243
    Bengt Richter
    Aug 11, 2003
  2. Greg
    Replies:
    7
    Views:
    26,936
    vektor
    May 17, 2011
  3. John Nagle

    Unescaping URLs in Python

    John Nagle, Dec 25, 2006, in forum: Python
    Replies:
    3
    Views:
    641
    Jeffrey Froman
    Dec 25, 2006
  4. Jonny
    Replies:
    7
    Views:
    455
    Jonny
    Dec 20, 2005
  5. sprite
    Replies:
    2
    Views:
    318
    sprite
    Sep 2, 2010
Loading...

Share This Page