Solved

web.congfig redirect with & symbol in it

Posted on 2013-05-11
8
378 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
  • 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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.…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

810 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