close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

URL parameters and Ampersands

Thread begun 7/29/2009 2:11 pm by ccooper309155 | Last modified 7/29/2009 5:10 pm by ccooper309155 | 4827 views | 5 replies |

ccooper309155

URL parameters and Ampersands

Hi

Using ASP VB.

I need to send some railroad names to another page via URL parameter.

A name like Southern Pacific works:

e.g. railroad_prod_list.asp?Road=Southern%20Pacific

But a name such as Baltimore & Ohio doesn't work because of the ampersand.

e.g. railroad_prod_list.asp?Road=Baltimore%20&%20Ohio

The ampersand confuses things because it means something different to the server and browser.

How can I work around this?

And no, I can't change the railroad names!

Thanks

Craig

Sign in to reply to this post

Justin Nemeth

try using Server.URLEncode() around your railroad names. That should convert the & to a url friendly character.

Sign in to reply to this post

ccooper309155

Originally Said By: Justin Nemeth
  try using Server.URLEncode() around your railroad names. That should convert the & to a url friendly character.  



Thanks.

Will give it a try and let you know how it goes.

Does it matter that the railroad names are generated dynamically on the sending page?

Sign in to reply to this post

Justin Nemeth

No, that function can accept any string - so a field from the database could just be wrapped in that function.

Sign in to reply to this post

ccooper309155

Originally Said By: Justin Nemeth
  No, that function can accept any string - so a field from the database could just be wrapped in that function.  



Okay, I'm a dope.

Here is my link:


<a href="railroad_list.asp?RailRoad=<%=(rs_Railroad.Fields.Item("RailRoad").Value)%>"><%=(rs_Railroad.Fields.Item("RailRoad").Value)%></a>

How/where exactly do I apply the Server.URLEncode() to this code?

Everything I tried didn't work.

Thanks!

Sign in to reply to this post

ccooper309155

I solved it:

<a href="railroad_list.asp?RailRoad=<%=(Server.URLEncode((rs_Railroad.F ields.Item("RailRoad").Value)))%>"><%=(rs_Railroad.F ields.Item("RailRoad").Value)%></a>

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...