Created
October 5, 2011 11:42
-
-
Save jdaigle/1264267 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Configuration; | |
using System.Web; | |
using System.Web.Mvc; | |
namespace Example.Web { | |
public class MvcApplication : HttpApplication { | |
protected void Application_EndRequest() { | |
var context = new HttpContextWrapper(Context); | |
// If we're an ajax request, and doing a 302, then we actually need to do a 401 | |
if (Context.Response.StatusCode == 302 && context.Request.IsAjaxRequest()) { | |
Context.Response.Clear(); | |
Context.Response.StatusCode = 401; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment