Problem with Server.UrlEncode

Discussion in 'ASP .Net' started by Hemant, Sep 23, 2009.

  1. Hemant

    Hemant Guest

    Hi,
    I am encoding a url with Server.UrlEncode. in vb.net 2005 web application
    example :
    Server.UrlEncode("Test URL:Test Name ")

    It encode the url in Test URL%3aTest Name but this give me HTTP Error 400 -
    Bad Request.

    same happens for "%" character.
    How to handle this
    Please help me

    Thanks,
    Hemant
     
    Hemant, Sep 23, 2009
    #1
    1. Advertising

  2. Hemant

    Sreenivas Guest

    On Sep 23, 1:03 pm, "Hemant" <> wrote:
    > Hi,
    > I am encoding a url with Server.UrlEncode. in vb.net 2005 web application
    > example :
    > Server.UrlEncode("Test URL:Test Name  ")
    >
    > It encode the url in Test URL%3aTest Name  but this give me HTTP Error 400 -
    > Bad Request.
    >
    > same happens for "%" character.
    > How to handle this
    > Please help me
    >
    > Thanks,
    > Hemant


    Those special characters (such as colon, semi colon,etc)are not
    allowed in the URL ,
    see the below URL , though that is Java centric ,you could straight
    away understand it.
    http://www.javapractices.com/topic/TopicAction.do?Id=96
     
    Sreenivas, Sep 23, 2009
    #2
    1. Advertising

  3. "Hemant" <> wrote in
    news::

    > Hi,
    > I am encoding a url with Server.UrlEncode. in vb.net 2005 web
    > application example :
    > Server.UrlEncode("Test URL:Test Name ")
    >
    > It encode the url in Test URL%3aTest Name but this give me HTTP Error
    > 400 - Bad Request.
    >
    > same happens for "%" character.
    > How to handle this
    > Please help me


    URL encoding is used for arguments, not the actual URL. For example, you
    might have a forwarder like:

    http://mysite.com/forward.aspx?url=http://www.microsoft.com

    Only the argument is url encoded. And, when you actually forward on
    forward.aspx, you would decode before doing the response.redirect on the
    url.

    Peace and Grace,


    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    My vacation and childhood cancer awareness site:
    http://www.crazycancertour.com

    *******************************************
    | Think outside the box! |
    *******************************************
     
    Gregory A. Beamer, Sep 23, 2009
    #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. Andreas Klemt
    Replies:
    4
    Views:
    10,304
    mikeb
    Jan 22, 2004
  2. msn

    Server.UrlEncode error???

    msn, Feb 20, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    475
  3. Dario Sala
    Replies:
    1
    Views:
    3,805
    Karl Seguin
    Nov 15, 2004
  4. George Hester

    My problem with Server.URLEncode as used here

    George Hester, Nov 19, 2004, in forum: ASP General
    Replies:
    3
    Views:
    244
    George Hester
    Nov 21, 2004
  5. MyndPhlyp
    Replies:
    3
    Views:
    491
    MyndPhlyp
    Oct 3, 2005
Loading...

Share This Page