I'm still a bit new to ASP.Net MVC and Custom Routing and I'm not quite sure how to ask this question other than to post the URL link and the route that I'm using and ask for advice.
The problem is:
A potentially dangerous Request.Path value was detected from the client (&).
This is being caused by an "&" symbol inside my link:
http://localhost/search/cars-&-motorcycles
And, here's my route:
routes.MapRoute(
"CategorySearch",
"category/{searchcriteria}",
new { controller = "Listing", action = "Index", isCategory = true, searchcriteria = UrlParameter.Optional }
);
What I want to do is strip out the "&" from the optional paramter before it gets passed, hopefully that will correct the "potentially dangerous" issue that I'm experiencing. I've tried to use
UrlParameter.Optional.ToString().Replace("&", "")
Is it even possible to strip out that "&" symbol from somewhere inside the Route.MapRoute method at all?