Click here to Skip to main content
15,886,052 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
Getting error while adding values to key.

<add key="RedirectionPge" value="https://Test.aspx?sourcedoc={Test}&file=Process.docx&action=default" />

Entity "File" not defined

Entity "Action" not defined

How can i treat this two word as string and add it to value.

Thanks

What I have tried:

Tried with adding "'"File"'" but not succeded
Posted
Updated 13-Jul-16 21:05pm
v2

You need to encode the URL prior to redirect.
The error is showing because it considers the "&" as query string separator and thus treats "file" as another query string variable.
The UTF-8 equivalent of "&" is "%26" and that of "=" is "%3D".

Check following tutorial for detailed information-
HTML URL Encoding Reference[^]

In Javascript you can make use of
- JavaScript encodeURI() Function[^]
- JavaScript decodeURI() Function[^]

For ASP.Net check-
- HttpServerUtility.UrlEncode Method (String) (System.Web)[^]

Hope, it helps :)
 
Share this answer
 
Use "amp;" after & in value url

XML
<add key="RedirectionPge" value="https://Test.aspx?sourcedoc={Test}&amp;file=Process.docx&amp;action=default" />
 
Share this answer
 
Use "amp;" after &

XML
<add key="RedirectionPge" value="https://Test.aspx?sourcedoc={Test}&amp;file=Process.docx&amp;action=default" />
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900