ما عنوان url الذي يُرجعه urlReferrer في Asp.net؟

برمجة


على سبيل المثال، إذا انتقلت إلى صفحتي من “https://help.salesforce.com/apex/HTViewHelpDoc?id=sso_saml_assertion_examples.htm&language=en”، ما القيمة التي أرجعها هذا الرمز “HttpContext.Current.Request.UrlReferrer”؟

الحل 1

القيمة التي تم إرجاعها بواسطة هذا الرمز
قيمة “HttpContext.Current.Request.UrlReferrer” فارغة

ولكن إذا كنت بحاجة إلى قيمة المعلمة الأولى:
HttpContext.Current.Request.Params[0] القيمة هي “sso_saml_assertion_examples.htm”

الحل 2

يشير مُحيل http إلى الصفحة السابقة التي أرسلت البيانات أو المرتبطة بالصفحة الجديدة
يمكنك الحصول عليه في ASP.NET باستخدام 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;
}

الحل 3

نعم، سيعيد عنوان URL السابق الذي قمت بنشره مرة أخرى إلى الصفحة الحالية
احصل على معلومات اكثر

コメント

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