1
3
在我做了研究之后(我无法在帖子上标记任何善意的答案) 然后我测试了在中遇到的两个选项 this Stack Overflow Page 以下为: 第一个选项(由Ahmad Mageed给出)我已经测试过可以正常工作。 可读性很容易理解(因为我对asp.net的“技巧”还很陌生) 然后回答 annakata,这是一个显著改进的方法 实际上不必重定向即可获得结果-查询字符串已修改 玩了一番之后,我决定跟着玩 annakata s方法 并制作一个同时使用重拨选项的辅助方法 具有修改的QueryString参数&价值观
我发现它对那些对asp.net开发经验少得多的人很有帮助 所以我把它作为我的正确答案发布,正如我所看到的。 我希望它能帮助其他寻求同样解决方案的人。 我说过,我不是一个公认的天才。。然而 |
2
0
您可以使用
链接: http://msdn.microsoft.com/en-us/library/ms972974.aspx 正在注册:
链接: http://msdn.microsoft.com/en-us/library/ms227673%28v=vs.100%29.aspx |
3
0
这里的问题是“真相的来源”问题。这个 NameValueCollection 暴露于 HttpRequest.QueryString 公开查询字符串,不应进行修改,因为查询字符串是由调用方提供的。如果应用程序有一个UserName查询字符串参数,但可能需要对其进行更改,例如为了进行测试,请将其包装在一个方法中,该方法可以在需要时将其从备用源中获取。例如:
因此,与其直接为用户名(或任何一条信息)调用QueryString,不如调用SystemInfo上的属性(糟糕的名称,但你明白了)。它允许更改设置的来源,例如如果代码在网页外部使用或用于测试。 |