Link to home
Start Free TrialLog in
Avatar of taz8020
taz8020Flag for United Kingdom of Great Britain and Northern Ireland

asked on

web.congfig redirect with & symbol in it

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
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

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.
Avatar of taz8020

ASKER

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
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
like
<add key="/acatalog/car_&amp;_vehicle_accessories.html" value="/ProductSection/Car_And_Vehicle_Accessories.aspx"/>
Avatar of taz8020

ASKER

Hi Rainerj, thanks but i still get an error saying & is not allowed
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
Avatar of taz8020

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial