在ASP.NET URL查询字符串工作 [英] Working with URL query Strings in ASP.NET
问题描述
我是新来使用ASP.NET,并希望找到的网址查询字符串,以最好的工作方式。
I am new to working with ASP.NET and want to find the best way to work with URL query strings.
我可以使用的Request.QueryString [UrlKey]
得到一个URL查询字符串的当前值,但实际上我修改与code中的网址,没有做一个表格 GET
提交?
I can get the current value of a URL query string by using Request.QueryString["UrlKey"]
, but can I actually modify the URL with code, without doing a form GET
submission?
如果用户登陆页面上的第一次,什么是编程创建的最简单的方法是什么?UrlKey =值
通过 Page_Load中
的方法?还是我更好地做这个JavaScript或建立重定向像:字符串重定向=?www.mysite.com +的myKey +=+ myvalue的;
If the user is landing on the page for the first time, what is the easiest way to programmatically create the ?UrlKey=value
through the Page_load
method? Or am I better of doing this with Javascript or building a redirect Like: string redirect = "www.mysite.com?" + MyKey + "=" + MyValue;
推荐答案
这听起来像你想做到这一点:
It sounds like you want to do this:
string redirect = "www.mysite.com?mykey=" + MyValue.ToString();
Response.Redirect(redirect);
这篇关于在ASP.NET URL查询字符串工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!