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.

Thanks

Recommended Answers

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.