Solved

web.congfig redirect with & symbol in it

Posted on 2013-05-11
8
396 Views
Last Modified: 2013-07-05
Hi I am having trouble redirecting a few pages with & in it

eg   <add key="/acatalog/car_&_vehicle_accessories.html" value="/ProductSection/Car_And_Vehicle_Accessories.aspx"/>

the & symbol is causing me the error and ideas how to get arround it
0
Comment
Question by:taz8020
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39158034
Hi,
the & (ampersand) is a reserved character and is not allowed as part of the path of an url. Ampersands are used to separate url parameters, so you will have to use another character like underscore or dash.
0
 
LVL 3

Author Comment

by:taz8020
ID: 39158040
the problem is our old site used ampersand on about 20 urls and google have indexed them trying to redirect thrm to the new page that does not have them
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39158042
But if you need the url this way you would have to escape the ampersand with &amp; in the config.
http://xmmssc-www.star.le.ac.uk/SAS/xmmsas_20070308_1802/doc/param/node24.html
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39158060
like
<add key="/acatalog/car_&amp;_vehicle_accessories.html" value="/ProductSection/Car_And_Vehicle_Accessories.aspx"/>
0
 
LVL 3

Author Comment

by:taz8020
ID: 39173307
Hi Rainerj, thanks but i still get an error saying & is not allowed
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39174423
Hi,
could you perhaps explain where and how you redirect (custom coded, ...)?
At least the last posted app key is valid in regards to general web.config rules.
Do you have a screenshot/detailed error message?
Thanks.
HTH
Rainer
0
 
LVL 3

Author Comment

by:taz8020
ID: 39174567
A potentially dangerous Request.Path value was detected from the client (&).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: A potentially dangerous Request.Path value was detected from the client (&).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (&).]
   System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +9023321
   System.Web.PipelineStepManager.ValidateHelper(HttpContext context) +59
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 39175443
Ah,
here we go
http://stackoverflow.com/questions/6025522/getting-a-potentially-dangerous-request-path-value-was-detected-from-the-client
You will have to configure the following setting in web.config (thats the default value)
<httpRuntime requestPathInvalidCharacters="&lt;,&gt;,*,%,&amp;,:,\,?" />
Just remove the &amp; (and any other character you may have) and it should work.
HTH
Rainer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question