本文整理汇总了C#中System.Web.HttpContextWrapper.AuthenticateCurrentRequest方法的典型用法代码示例。如果您正苦于以下问题:C# HttpContextWrapper.AuthenticateCurrentRequest方法的具体用法?C# HttpContextWrapper.AuthenticateCurrentRequest怎么用?C# HttpContextWrapper.AuthenticateCurrentRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.HttpContextWrapper
的用法示例。
在下文中一共展示了HttpContextWrapper.AuthenticateCurrentRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AuthenticateTicket
public static bool AuthenticateTicket() {
// see http://issues.umbraco.org/issue/U4-6342#comment=67-19466 (from http://issues.umbraco.org/issue/U4-6332)
var http = new HttpContextWrapper(HttpContext.Current);
var ticket = http.GetUmbracoAuthTicket();
if (ticket != null)
{
return http.AuthenticateCurrentRequest(ticket, true);
}
return false;
}
示例2: OnPreInit
protected override void OnPreInit(EventArgs e) {
base.OnPreInit(e);
if (PackageHelpers.UmbracoVersion != "7.2.2") return;
// Handle authentication stuff to counteract bug in Umbraco 7.2.2 (see U4-6342)
HttpContextWrapper http = new HttpContextWrapper(Context);
FormsAuthenticationTicket ticket = http.GetUmbracoAuthTicket();
http.AuthenticateCurrentRequest(ticket, true);
}
示例3: AuthenticateRequest
/// <summary>
/// Authenticates the request by reading the FormsAuthentication cookie and setting the
/// context and thread principle object
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <remarks>
/// We will set the identity, culture, etc... for any request that is:
/// * A back office request
/// * An installer request
/// * A /base request (since these can be back office web service requests)
/// </remarks>
static void AuthenticateRequest(object sender, EventArgs e)
{
var app = (HttpApplication)sender;
var http = new HttpContextWrapper(app.Context);
// do not process if client-side request
if (http.Request.Url.IsClientSideRequest())
return;
var req = new HttpRequestWrapper(app.Request);
if (ShouldAuthenticateRequest(req, UmbracoContext.Current.OriginalRequestUrl))
{
var ticket = http.GetUmbracoAuthTicket();
http.AuthenticateCurrentRequest(ticket, ShouldIgnoreTicketRenew(UmbracoContext.Current.OriginalRequestUrl, http) == false);
}
}