urlReferrer在Asp.net中返回的url是什么? [英] what url return by urlReferrer in Asp.net?

查看:60
本文介绍了urlReferrer在Asp.net中返回的url是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,如果我从https://help.salesforce.com/apex/HTViewHelpDoc?id=sso_saml_assertion_examples.htm&language=en导航到我的页面,此代码返回的值为HttpContext.Current。 Request.UrlReferrer?

解决方案

此代码返回的值

HttpContext.Current.Request.UrlReferrer值为null



但是如果你需要第一个参数值:

HttpContext.Current.Request.Params [0]值是sso_saml_assertion_examples.htm

http referrer指示已提交数据或链接到新页面的上一页

您可以使用类似

在ASP.NET中获取它

  //   PageName来自HttpContext.Current.Request .RawUrl并由Page_Load事件提供。 
public static string GetReferrerPageName()
{
string functionReturnValue = ;

if ((((System.Web.HttpContext.Current.Request.UrlReferrer)!= null ))){
functionReturnValue = HttpContext.Current.Request.UrlReferrer.ToString();
} else {
functionReturnValue = N / A;
}
return functionReturnValue;
}


是的,它会返回您回到当前页面的上一个网址

获取更多信息

http:// msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer(v=vs.110).aspx

For example if i am navigate to my page from "https://help.salesforce.com/apex/HTViewHelpDoc?id=sso_saml_assertion_examples.htm&language=en", what value returned by this code "HttpContext.Current.Request.UrlReferrer"?

解决方案

value returned by this code
"HttpContext.Current.Request.UrlReferrer" value is null

But if you need to first parameter value:
HttpContext.Current.Request.Params[0] value is "sso_saml_assertion_examples.htm"


http referrer indicates the previous page that has submitted data or linked to the new page
you can get it in ASP.NET using like

//PageName comes from HttpContext.Current.Request.RawUrl and is supplied by the Page_Load event.
public static string GetReferrerPageName()
{
    string functionReturnValue = null;

    if ((((System.Web.HttpContext.Current.Request.UrlReferrer) != null))) {
        functionReturnValue = HttpContext.Current.Request.UrlReferrer.ToString();
    } else {
        functionReturnValue = "N/A";
    }
    return functionReturnValue;
}


Yes it will return the previous url where you have posted back to current page
Get more information
http://msdn.microsoft.com/en-us/library/system.web.httprequest.urlreferrer(v=vs.110).aspx


这篇关于urlReferrer在Asp.net中返回的url是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆