Results 1 to 5 of 5

Thread: URL Encoding

  1. #1
    Join Date
    Jan 2003
    Posts
    106

    Post Unanswered: URL Encoding

    Hi,

    I need to pass a url to a javascript function.Do i need to enclode the url before sending to the java script function,if so how shall i do it in ASP.

    <Script language="javascript">
    function process_url(lurl)
    {
    document.frm.action=lurl;
    document.frm.submit();
    }
    </script>

    <%
    dim a
    url="http://www.google.com"
    %>
    <input type="button" onclick="process_url('<%=url%>')">

    this example shows passing url hotmail.com but actually i need to pass urls stored in the database.
    Sachi

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    I don't think you will need to as it will be encoded by the browser itself won't it??

    If you do need to here is the function to encode urls Server.HTMLEncode(url)
    Last edited by rokslide; 04-27-04 at 01:43.

  3. #3
    Join Date
    Jan 2003
    Posts
    106

    i donno

    I donno,thats why I am asking you guys,I have to be sure with it.

    anyone who have done this earlier,pl. respond.
    Sachi

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    really it should only depend on the urls you could be using... for example are you having a url of

    http://www.myweb.com/test.asp&myName=Farmer John

    or would it be....

    http://www.myweb.com/test.asp&myName=Farmer%20John

    if it is the former you would need to encode, if the later you shouldn't need to.... btw, check the edit above for the other part of the answer....

  5. #5
    Join Date
    Jan 2003
    Posts
    106

    yes

    I got the answer I am using Server.URLEncode function
    Sachi

Posting Permissions

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