Passing a parameter with an ampersand to a controller action method
asp.net, asp.net-mvc, c#, razor
Solution
Add this to `web.config`'s `httpRuntime`:
<httpRuntime requestPathInvalidChars="<,>,*,%,:,\,?" />
By default that list includes `&`, you are simply removing it
Problem
I have a view that displays a link of vendors, with a link to each vendor detail page ``` @foreach (var vendor in Model.Vendors) { <li> <a href="/Vendors/@(vendor.Name)">@vendor.Name</a> </li> } ``` One particular vendor is named "ABC Sales & Services", so the link to their detail page is `/Vendors/ABC Sales & Services`. When I navigate to that url, I get this error: A potentially dangerous Request.Path value was detected from the client (&). Is there a way to get around this?