I am getting this error: A potentially dangerous Request.Path value was detected from the client (:).
I am trying to pass a DateTime and an int to an ActionResult, I have created a custom route to deal with it. I can't see (:) in my URL so don't know how to replace the string. Is it the (%) in the date of my URL that are causing it? Here is my code that is passing the variables to the controller:
//View
DateTime raceDate = DateTime.Today;
<center><a href="@Url.Action("EventInfo", new {raceDate= date, trackID=trID})" class="buttonize" target="_blank">View</a></center>
//Controller
public ActionResult EventInfo(DateTime raceDate, int trackID )
{
EventInfomodel = new EventInfo();
model.MyRace = db.GetRaceDetails(raceDate, trackID)
return View(model);
}
//Route.Config
routes.MapRoute("Home/EventInfo", "Home/EventInfo/{raceDate}/{trackID}", new { controller = "Home", action = "EventInfo", raceDate = UrlParameter.Optional, trackID= UrlParameter.Optional });
The URL in my browser looks like this:
Home/EventInfo/04/22/2019%2000%3a00%3a00/59
I'm completely new MVC and C# so any help would be great, thank you.