示例#1
0
 /// <summary>
 /// Logs the user out and returns either an empty 200 response for ajax requests, or a redirect response for non-ajax. <seealso cref="M:Nancy.Extensions.RequestExtensions.IsAjaxRequest(Nancy.Request)" />
 /// </summary>
 /// <param name="module">Nancy module</param>
 /// <param name="redirectUrl">URL to redirect to</param>
 /// <returns>Nancy response with redirect if request was not ajax, otherwise with OK.</returns>
 public static Response Logout(this INancyModule module, string redirectUrl)
 {
     if (!module.Context.Request.IsAjaxRequest())
     {
         return(CustomAuthenticationProvider.LogOutAndRedirectResponse(module.Context, redirectUrl));
     }
     return(CustomAuthenticationProvider.LogOutResponse());
 }
示例#2
0
 /// <summary>Logs the user out and redirects</summary>
 /// <param name="module">Nancy module</param>
 /// <param name="redirectUrl">URL to redirect to</param>
 /// <returns>Nancy response instance</returns>
 public static Response LogoutAndRedirect(this INancyModule module, string redirectUrl)
 {
     return(CustomAuthenticationProvider.LogOutAndRedirectResponse(module.Context, redirectUrl));
 }