gpt4 book ai didi

url - 从 URL 读取参数

转载 作者:行者123 更新时间:2023-12-04 01:47:48 24 4
gpt4 key购买 nike

我一直在谷歌上寻找一种从 URL 读取参数值的方法,但没有成功。在 ASP.NET Webform 中,我们使用 Request.Querystring["name"] 来获取值。如何在MVC3中做到这一点?

我需要访问 HtmlHelper 类中的参数。任何人请。

对此,互联网上没有明确的答案。奇怪的...

最佳答案

我还在用HttpContext.Current.Request.QueryString在MVC3...

if (!Request.QueryString["ParameterName"].IsEmpty())
{
// Do something only if URL parameter "ParameterName" is not empty...
}

例如:

http://192.168.1.106:7777/Measurement?sort=FatPercentage&sortdir=DESC
if (!Request.QueryString["sort"].IsEmpty())
{
// sort=FatPercentage. It's not empty and this code block will be executed
}

关于url - 从 URL 读取参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6171059/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com