Modify HttpContext.Current.User is breaking the optimization bundle

2

I've run a couple of tests and found that by modifying HttpContext.Current.User Application_PostAuthenticateRequest (Global.asax.cs) I get an Internal Server Error in the concatenated / mined bundle request.

Follow the code quoted:

protected void Application_PostAuthenticateRequest( Object sender, EventArgs e )
    {
        HttpContext.Current.User = SessionManager.GetCurrentUser( Request );

        if (IsWebApiRequest())
        {
            HttpContext.Current.SetSessionStateBehavior( SessionStateBehavior.Required );
        }
    }

    private bool IsWebApiRequest()
    {
        return HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath.StartsWith( WebApiConfig.UrlPrefixRelative );
    }

    
asked by anonymous 14.12.2015 / 22:13

1 answer

2

The problem was that SessionManager.GetCurrentUser( Request ); is null and assigning% b_% to the bundle generated an exception.

    
14.12.2015 / 22:54