Solved

web.congfig redirect with & symbol in it

Posted on 2013-05-11
8
356 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 44

Expert Comment

by:Rainer Jeschor
Comment Utility
like
<add key="/acatalog/car_&amp;_vehicle_accessories.html" value="/ProductSection/Car_And_Vehicle_Accessories.aspx"/>
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Author Comment

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

Expert Comment

by:Rainer Jeschor
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
work allocation; web development; vba; access; 4 46
Problem to go to Web page 2 46
String manipulation 15 49
Achieve json result 2 24
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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now