I have a url http://localhost/Home/DomSomething?t=123&s=TXand I want to redirect this url to the following action method
public class HomeController
{
public ActionResult DoSomething(int taxYear,string state)
{
}
}
Because the query string names do not match the parameter name of the action method, the query does not route the action method.
If I changed the URL (for testing only) to http://localhost/Home/DomSomething?taxYear=123&state=TX, then its working. (But I do not have access to modify the request.)
I know that an attribute Routecan be applied to an action method and can display tin taxYearand son state.
However, I do not find the correct Route attribute syntax for this mapping, can anyone help?
source
share