Solved

web.congfig redirect with & symbol in it

Posted on 2013-05-11
8
385 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I run RAW complex query's with Entity Framework Core 1 39
Add or delete table rows 10 55
Generate Unique ID in VB.NET 21 68
Visual Studio npm 1 12
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 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