MVC and positional parameters in a query string

Posted by Pete Nelson on Stack Overflow See other posts from Stack Overflow or by Pete Nelson
Published on 2010-03-22T14:37:36Z Indexed on 2010/03/22 14:41 UTC
Read the original article Hit count: 328

Filed under:

This is more of a question to satisfy my curiosity vs something I really need answered. Back in ASP.NET WebForms, I'd occasionally use a positional parameter in a query string if I only had to pass one thing to a page. For example:

http://localhost/site/MyPage.aspx?ABCD1234

Then my code would look like this:

string accountNumber = "";
if (Request.QueryString.Count > 0)
   accountNumber = Request.QueryString[0];

In MVC, can you pass a positional query string parameter to a controller method instead of accessing it through Request.QueryString?

© Stack Overflow or respective owner

Related posts about asp.net-mvc