Use URLEncode

Discussion in 'ASP .Net' started by Grey, May 4, 2004.

  1. Grey

    Grey Guest

    How can I use the URLEncode in ASP.NET?? If i used URLEncode to encode the URL, how can I decode the URL with proper parameter values in ASP.NET?? I can encode the URL, but i cannot decode it properly...

    Million Thanks..
     
    Grey, May 4, 2004
    #1
    1. Advertising

  2. Grey

    avnrao Guest

    You can use HttpUtility.UrlDecode to decode it.

    Av.
    "Grey" <> wrote in message news:%...
    How can I use the URLEncode in ASP.NET?? If i used URLEncode to encode the URL, how can I decode the URL with proper parameter values in ASP.NET?? I can encode the URL, but i cannot decode it properly...

    Million Thanks..
     
    avnrao, May 4, 2004
    #2
    1. Advertising

  3. Grey

    David Jessee Guest

    the good thing is\s you don't have to worry about it.

    for instance,
    dim invalid_param as string = "abc/\/\&#x y z"
    Response.Redirect("page.aspx?param=" & Server.URLEncode(invalid_param))

    then inside of page.aspx......
    dim theVariable as String = Request.parameters("param")


    theVariable is now equal to "abc/\/\&#x y z". Since it was URLEncoded it it placed corrently into the QueryString. Because the params collection (or QueryString Collection) makes the assumption that you want it to be decoded.

    "Grey" <> wrote in message news:%...
    How can I use the URLEncode in ASP.NET?? If i used URLEncode to encode the URL, how can I decode the URL with proper parameter values in ASP.NET?? I can encode the URL, but i cannot decode it properly...

    Million Thanks..
     
    David Jessee, May 4, 2004
    #3
    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. Russ

    URLEncode

    Russ, Aug 4, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    2,983
    mikeb
    Aug 4, 2003
  2. vtreddy

    Datagrid HYperlinnk column URLEncode

    vtreddy, Oct 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    404
    vtreddy
    Oct 24, 2003
  3. vtreddy

    URLEncode Problem from ASP.NET

    vtreddy, Oct 25, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    5,716
    vtreddy
    Oct 25, 2003
  4. Andreas Klemt
    Replies:
    4
    Views:
    10,374
    mikeb
    Jan 22, 2004
  5. Dario Sala
    Replies:
    1
    Views:
    3,868
    Karl Seguin
    Nov 15, 2004
Loading...

Share This Page