【解決方法】Asp.netのurlReferrerによって返されるURLは何ですか?


たとえば、「https://help.salesforce.com/apex/HTViewHelpDoc?id=sso_saml_assertion_examples.htm& language=en」から自分のページに移動した場合、このコード「HttpContext.Current.Request.UrlReferrer」によって返される値は何ですか?

解決策 1

このコードによって返される値
「HttpContext.Current.Request.UrlReferrer」値が null です

ただし、最初のパラメータ値が必要な場合は、次のようにします。
HttpContext.Current.Request.Params[0] 値は「sso_saml_assertion_examples.htm」です

解決策 2

http リファラーは、データを送信したか、新しいページにリンクした前のページを示します。
ASP.NET で次のように使用して取得できます

C#
//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;
}

解決策 3

はい、現在のページに投稿した前の URL が返されます。
さらに詳しい情報を得る

コメント

タイトルとURLをコピーしました