Results 1 to 3 of 3

Thread: Server.URLEncode question

  1. #1
    Join Date
    Jan 2003

    Server.URLEncode question

    Hi - how is Server.URLEncode supposed to work?

    If I write:

    <a href="http://www.somesite.com?SomePage.asp?<%=Server.URLEncode("PageFrom=ProductPage&CoGUID=D4D47017-AA4D-47B6-8A8D-2D554F2AFD0D")%>">Go somewhere</a>
    The receiving page cannot extract the CoGuid from the QueryString.

    If I write:

    <a href="http://www.somesite.com?SomePage.asp?PageFrom=ProductPage&CoGUID=<%=Server.URLEncode("D4D47017-AA4D-47B6-8A8D-2D554F2AFD0D")%>">Go somewhere</a>
    ... the CoGuid can be retrieved.

    But I thought Server.URLEncode could be used to encode the whole string?

    I tried

    Dim strURL
    strURL = "http://www.somesite.com?SomePage.asp?PageFrom=ProductPage&CoGUID=D4D47017-AA4D-47B6-8A8D-2D554F2AFD0D"
    <a href="<%=Server.URLEncode(strURL)%>">Go somewhere</a>
    But when you mouse over the link it has put the web address of the site I am on in front of the url. So if the page is on www.mysite.com the link then looks like ...
    So what am I doing wrong? Can you encode a whole string with Server.URLEncode and, if you can, how do you stop it prefixing the string with the URL of the site the page is on?

    Why can't I encode the bit after the ? in the URL. If I do this the CoGUID is not retrieved from the querystring.

    What am I doing wrong? Thanks for any help.

  2. #2
    Join Date
    Mar 2006
    A little more info can be found here :


    Maybe this helps you

  3. #3
    Join Date
    Jan 2003
    Thanks for your reply but it does not help me. I am using Server.URLEncode as they suggest - encoding a whole string, but the name/value pairs cannot be retrieved from the querystring on the destination page.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles