如何访问查询字符串在ASP.Net MVC视图 [英] how to access querystring in ASP.Net MVC View

查看:113
本文介绍了如何访问查询字符串在ASP.Net MVC视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何在一个视图访问查询字符串值

How will i access the querystring value in a view

推荐答案

这不是一个好的设计来访问视图中的查询参数。视图应该使用由控制器提供的模型。所以控制器读取查询参数并将它们传递到视图中。如果你想忽略这个规则,你总是可以做到这一点在你的观点:

It is not a good design to access query parameters in a view. The view should use the model provided by the controller. So the controller reads query parameters and passes them to the view. If you want to ignore this rule you could always do this in your view:

<%= Request["SomeParameter"] %>

但我强烈这么做气馁。

But I would strongly discourage you from doing so.

这篇关于如何访问查询字符串在ASP.Net MVC视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆