// Called after a handler method has been selected, but before model binding occurs. public override void OnPageHandlerSelected(Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext context) { // for now only write a mesg to console Console.WriteLine("Entered Event Method: {0}", @"OnPageHandlerSelected"); _log.LogDebug("Entered Event Method: {0}", @"OnPageHandlerSelected"); TestCookie(context); }
public void TestCookie(Microsoft.AspNetCore.Mvc.Filters.PageHandlerSelectedContext context) { _log.LogInformation("Testing CALLER tag for this entry."); string lsSessionCookieTag; var lbCookiExists = context.HttpContext.Request.Cookies.TryGetValue(MpaConstants.CookieName, out lsSessionCookieTag); _log.LogDebug("Cookie esists? {0}, Key {1} has value {2}", lbCookiExists, MpaConstants.CookieName, lsSessionCookieTag); if (!HttpContext.Request.Cookies.ContainsKey(MpaConstants.CookieName)) { lsSessionCookieTag = Guid.NewGuid().ToString("D"); _log.LogInformation("Create session tag '{0}' with key {1}", lsSessionCookieTag, MpaConstants.CookieName); context.HttpContext.Response.Cookies.Append(MpaConstants.CookieName, lsSessionCookieTag); } }
public Task OnPageHandlerSelectionAsync(PageHandlerSelectedContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (context.HandlerInstance is IAsyncPageFilter asyncPageFilter) { return(asyncPageFilter.OnPageHandlerSelectionAsync(context)); } else if (context.HandlerInstance is IPageFilter pageFilter) { pageFilter.OnPageHandlerSelected(context); } return(Task.CompletedTask); }
public void OnPageHandlerSelected(PageHandlerSelectedContext context) { }
public static CompiledPageActionDescriptor CompiledPageActionDescriptor(this PageHandlerSelectedContext context) => context.ActionDescriptor.CompiledPageActionDescriptor();