如何从地址栏由客户端输入的值? [英] how to get the value from address bar entered by client?
问题描述
我不知道如何把冠军,但我会尝试在这里解释它的要求。搜索结果
通常情况下用户输入在浏览器地址栏中的URL,例如 www.example.com ,然后点击一个链接重定向到另一个页面的 www.example.com/test.aspx 。另外,用户还可以刚从地址栏输入/键入 www.example.com/test.aspx 如果他们知道的完整路径。
I don't know how to put the title but i will try to explain it the requirement here.
Normally user entered an URL in address bar in browser, for example www.example.com, then click a link and redirect to another page www.example.com/test.aspx. Alternatively, user also can just enter/type www.example.com/test.aspx from address bar if they know the full path.
所以,我写了一个code其中用户可以键入在地址栏中的URL,例如需要的 www.example.com/test.aspx?usr=www.test.com。 (注:与另外的 USR =www.test.com)
结果在USR =www.test.com之后的 www.example.com/test.aspx?包含存储在数据库中的值。结果
所以,当用户键入 www.example.com/test.aspx?usr=www.test.com将在数据库中搜索匹配的 www.test.com 并做一些处理,如果发现。
So, i required to write a code where user can type an URL in address bar, for example www.example.com/test.aspx?usr="www.test.com". (note: with addition usr="www.test.com")
The "usr="www.test.com" after www.example.com/test.aspx? contain a value that stored in database.
So, when the user type www.example.com/test.aspx?usr="www.test.com" it will search the database for matching www.test.com and do some process if found.
我怎样才能做到这一点。
How can i achieve this.
推荐答案
您必须使用的的Request.QueryString 得到任何有价值的参数传递到页面。
结果,存储在页面变量,可用于检索所需要的数据。
You have to use Request.QueryString to get value any param passed to the page. The result, stored in a page variable, can be used to retrieve the needed data.
string usr = Request.QueryString["usr"];
这篇关于如何从地址栏由客户端输入的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!