Space in URL string?

Results 1 to 3 of 3

Thread: Space in URL string?

  1. #1
    David Morgan Guest

    Default Space in URL string?

    I&#039m building a URL string dynamically. Okay, not really the URL, but the query string. It works okay with:<BR><BR>www.mysite.com/my.asp?product=car -or-<BR>www.mysite.com/my.asp?product=&#060;%=strProduct%&#062; <BR><BR>But, if the querystring has a space, the URL ends up looking like:<BR><BR>www.mysite.com/my.asp?product=car wash<BR><BR>Explorer is smart enough to encode the space, but Netscape isn&#039t. So, I tried this:<BR><BR>www.mysite.com/my.asp?product=&#060;%=replace(strProduct," ","%20"&#062; <BR><BR>It works, but, I&#039m sure I may encounter other characters that navigator doesn&#039t encode correctly. Isn&#039t there any built in function for this? I tried "urlencode" but kept getting a vbscript error. <BR><BR>Many thanks for any suggestions?

  2. #2
    keithadler@hotmail.com Guest

    Default RE: Space in URL string?

    Check your URLEncode syntax:<BR><BR>&#060;%Response.Write(Server.URLEnc ode("http://www.microsoft.com?Bob=""Hope""")) %&#062;<BR><BR>Remember to use "" when trying to create a single ".<BR><BR>That always works for me.

  3. #3
    David Morgan Guest

    Default RE: Space in URL string?

    Aha!!! So, server.urlencode() is different from urlencode(). Might explain why it didn&#039t work for me. <BR><BR>Many thanks!<BR>David<BR>

Posting Permissions

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