C# UrlReferrer 到底是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10781563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 15:15:05  来源:igfitidea点击:

what does UrlReferrer exactly mean?

c#asp.netrequest

提问by SilverLight

what does UrlReferrer(Request.UrlReferrer& Request.UrlReferrer.OriginalString) exactly mean?
i wrote these codes :

UrlReferrer( Request.UrlReferrer& Request.UrlReferrer.OriginalString) 到底是什么意思?
我写了这些代码:

    if (Request.UrlReferrer != null)
    {
        User_Info.Add(!string.IsNullOrEmpty(Request.UrlReferrer.OriginalString) ? Request.UrlReferrer.OriginalString : string.Empty);//6:UrlReferrer
    }
    else
    {
        User_Info.Add(string.Empty);
    }

i just know ReturnUrl querystring when a user tries to login to admin area.
so in web.config <authentication mode="Forms">
and now we have UrlReferrer server-side code.
i want to gather some information about my users of my web site such as User-Agent , User-Browser , Session-ID , etc...
but i really do n't know what does UrlReferrer exactly do and it is always null.(i think because of wrong usage)
would you please give me a simple example for understanding.

当用户尝试登录管理区域时,我只知道 ReturnUrl 查询字符串。
所以在 web.config 中<authentication mode="Forms">
,现在我们有了 UrlReferrer 服务器端代码。
我想收集一些关于我的网站用户的信息,例如 User-Agent 、 User-Browser 、 Session-ID 等......
但我真的不知道 UrlReferrer 到底做了什么,它总是为空。 (我认为是因为错误的用法)
请你给我一个简单的例子来理解。

thanks for attention

谢谢关注

采纳答案by eyossi

quote:

引用:

When visiting a webpage, the referrer or referring page is the URL of the previous webpage from which a link was followed.

访问网页时,引​​荐来源网址或引荐页面是链接所来自的前一个网页的 URL。

for more information you can go to http://en.wikipedia.org/wiki/HTTP_referer

有关更多信息,您可以访问http://en.wikipedia.org/wiki/HTTP_referer

It can be null if you someone opened a browser and just entered your site address (without pressing a link to get there)

如果您打开浏览器并输入您的站点地址(没有按链接到达那里),则它可以为空