views:

234

answers:

2

i m passing URl from web config where i need to write
Example :: URL=http://www.google.co.in/search?hl=en&rlz=1R2SKPB_enIN332&ei=yktESuLfIIbg7APpquQj&sa=X&spell=1

if i write this url in web.config file i m getting in valid URL.

How to go about it?

+1  A: 

Web.config needs to be valid XML - so replace the & with &. When you read it from your config u can always convert it back with HtmlDecode

russau
i alredy tried with this option. replace the
jyoti
russau
+2  A: 

Make sure it is written using proper Xml encoding (which, amont other things, will replace all '&' characters with '&').

This should work well:

<add key="uri" value="http://www.google.co.in/search?hl=en&amp;amp;rlz=1R2SKPB_enIN332&amp;amp;ei=yktESuLfIIbg7APpquQj&amp;amp;sa=X&amp;amp;spell=1" />
Fredrik Mörk
lol - answered on the same second. i've never seen that before!
russau
jyoti
are you sure you can rewrite to a URL on another server? if not, rewrite to a page ON your server, and redirect from there...
russau
i am not sure about this , I will try with u r suggestion
jyoti
will u get me answer for this : can we rewrite the URL on another server?
jyoti
@jyoti: not sure about that. My spontaneous guess is "no", but I didn't work enough with url rewriting to give a definitive answer.
Fredrik Mörk