Use querystring variables in MVC controller

davids picture davids · Jul 15, 2012 · Viewed 165.4k times · Source

I am new to C#.net MVC and am trying to add FullCalendar to an MVC application.

The FullCalendar script automatically adds ?start={}&end={} to the URL...which is fine, but I have no idea how to use querystring variables in a controller.

The methods I used in Webforms applications don't work. What do I need to add to the controller to access the querystring variables?

Answer

Maess picture Maess · Jul 15, 2012
public ActionResult SomeAction(string start, string end)

The framework will map the query string parameters to the method parameters.