چطور در asp.net webforms ریدایرکت forms authentication را برای یک آدرس غیر فعال کنیم

mohsen1 سال قبل
ارسال شده در
mohsen

بوسیله پراپرتی SuppressFormsAuthenticationRedirect  ریسپانس می توانیم این کار را انجام بدیم. فقط کافیست در Global.asax.cs و رویداد Application_BeginRequest قطعه کد زیر را اضافه کنیم:

              protected void Application_BeginRequest()
        {
            var context = HttpContext.Current.Request.Path;
            if (string.Equals(context, "/specific-path", StringComparison.OrdinalIgnoreCase))
            {
                HttpContext.Current.Response.SuppressFormsAuthenticationRedirect = true;
            }
        }
    
رای
0
ارسال نظر
مرتب سازی:
اولین نفری باشید که نظر می دهید!