gpt4 book ai didi

c# - HttpUtility.ParseQueryString 奇怪的行为

转载 作者:太空宇宙 更新时间:2023-11-03 17:50:11 25 4
gpt4 key购买 nike

有人能给我解释一下 ParseQueryString 的这种行为吗:

var qs = HttpUtility.ParseQueryString("/Site/controller/Index?date=now");
var obj = qs["date"]; //qs["date"] is null

为什么 qs["date"] 为空?我想念什么?

谢谢。

最佳答案

您可能知道,ParseQueryString只需要 URL 的查询字符串部分,如果您有 URL,您可以使用此代码:

Uri myUri = new Uri("http://www.example.com/Site/controller/Index?date=now");
string param1 = HttpUtility.ParseQueryString(myUri.Query).Get("date");

关于c# - HttpUtility.ParseQueryString 奇怪的行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32256716/

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