Hi everyone,

I have a tricky question, at least for me. We have a website deployed on IIS that once in a while throws a NullPointerException when trying to read the HttpContext.Current.Application["JScriptRootPath"] value.

So this is the whole scenario:

This is just a key added in the Web.config file that is read in default.aspx.cs at application start and stored in the HttpContext.Application dictionary. This is used on our master page so it is accesses on all views (MVC 4 with Razor).

But... sometimes it throws this error. Now I have been able to get the error while debug-ing the IIS instance with Visual Studio, and the weird thing is, I can see the variable in the dictionary. This behavior also occurs if running the site with Visual Studio Development Server.

I have disabled Rapid Fail Protection for the Application Pool that the site runs under and it seems to have resolved the issue. But now I don't understand why I'm getting the error in Visual Studio Development Server. Since the app pool is available only under IIS (right?).

I have finally decided to change the logic and hold that value somwhere else, but I was wondering if anyone got this behavior and see what they did to prevent it.


Edited by pritaeas: Moved

4 Years
Discussion Span
Last Post by TnTinMN

Da**it... I had the C# forum opened... It should be in ASP.NET

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.