How to get query string parameter from MVC Razor markup?

后端 未结 6 1098
情歌与酒
情歌与酒 2020-12-13 22:58

I want to check the URL parameter in my Razor markup. For example, how do I do something like this:

6条回答
  •  独厮守ぢ
    2020-12-13 23:32

    Noneof the answers worked for me, I was getting "'HttpRequestBase' does not contain a definition for 'Query'", but this did work:

    HttpContext.Current.Request.QueryString["index"]
    

提交回复
热议问题