URL's with parameters in web.config - Derek Adkins

URL's with parameters in web.config

How would you do something like this under appSettings in the web.config file:

<add key="reportUrl" value="http://www.myreportserver.com/Customer%20Online/?comp=A&user=bob&level=2"/>

Because the validation fails with " Expecting ';' " at the ampersand.  I'm sure there must be an escape character I can use to store URL's with parameters in the web.config file.

Any help will be appreciated!

Published 17 October 2006 12:37 PM by derek

Comments

# bkelly said on 17 October, 2006 01:37 PM
The ampersand has special meaning in XML, so try escaping it using '&' (without quotes) instead.
# roaan said on 17 October, 2006 01:51 PM
Replace "&" with "&"
# trumpi said on 17 October, 2006 02:15 PM
Does "&" work? (Instead of "&")
# Craig Nicholson said on 17 October, 2006 02:18 PM
Ahh easy one. Its XML so you gotta escape the ampersand (&). To do this replace all "&" with "&".
# pwstevens said on 17 October, 2006 03:56 PM
Does this work: ??? the web config is xml so it should be escaped as such... let me know.
# ratty said on 17 October, 2006 04:10 PM
Use & ie: comp=A&user=bob
# trumpi said on 17 October, 2006 04:50 PM
lol - it seems as though the xml entities are being evalueted in all our comments. Let's try this again: replace "&" with "&amp;".
# Craig Nicholson said on 17 October, 2006 05:06 PM
Grrr damn HTML escape checking. Replace "&" with the following removing the underscore (_) "&_amp;".
# Thea Burger said on 17 October, 2006 09:50 PM
LOL, it was so funny reading all the comments...
# derek said on 18 October, 2006 09:38 AM

I know!  It is funny reading the comments... I did see the correct syntax in the email that I got though, so I did know what everyone was on about.  HaHaHa

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: