SuppressFormsAuthenticationRedirectModule
This class intercepts 401 requests and changes them to 402 errors. When this happens the FormAuthentication module will no longer hijack it and redirect back to login because it is a 402 error, not a 401. When the request ends, this class sets the status code back to 401 and everything works as it should.
PathToSuppress is the path inside your website where the above swap should happen.
If you can build for .net 4.5, you do not have to do this swap. You can take advantage of a new flag (SuppressFormsAuthenticationRedirect) that tells the FormAuthenticationModule to not redirect, which also means you will not need the EndRequest code.
Assembly: ServiceStack.dll
View Source
Declaration
public class SuppressFormsAuthenticationRedirectModule : IHttpModule
Properties
PathToSuppress
View Source
Declaration
public static string PathToSuppress { get; set; }
Methods
Init(HttpApplication)
View Source
Declaration
public virtual void Init(HttpApplication context)
Parameters
Type | Name |
---|---|
System.Web.HttpApplication | context |
Dispose()
View Source
Declaration
public void Dispose()
Implements
System.Web.IHttpModule