How to get query string parameter from MVC Razor markup?

后端 未结 6 1119
情歌与酒
情歌与酒 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:36

    It was suggested to post this as an answer, because some other answers are giving errors like 'The name Context does not exist in the current context'.

    Just using the following works:

    Request.Query["queryparm1"]
    

    Sample usage:

    GO
    

提交回复
热议问题