Take the 2-minute tour ×

Is it right to say that when Httpcontext object is null - so the iis is down ?

i know that when the first request to iis ( asp.net) the application manager creates

enviroment : Application Domain.

inside it theres Application Runtime.

And inside it there's blocks of (if theres more then 1 application on the server)

HttpApplication with each has httpContext which handler Response and Request.

enter image description here

So what does it mean when i get in asp.net HttpContext is null ?

share|improve this question
If you create another thread during the request, to do part of the work, you will not get a null HttpContext. HttpContext is local to the thread that is processing each specific request. –  Paolo Falabella Sep 2 '11 at 10:35

1 Answer 1

up vote 6 down vote accepted

I don't think that you can be running any ASP.NET application having IIS down, just by design :)

if you have a piece of code where the HttpContext.Current is null you are probably not running in the web server but somehow in another way, for example sometimes we have class libraries designed to be executed within the web application then somebody references those assemblies directly from a windows service, a console application or from the unit test project and of course there is no HttpContext !

web services as well, if served from IIS should have the context, if directly called with assembly reference and not web reference, can't reach any HttpContext.

show your failing code and describe where/how you use it and we will see why your context is null in that case.

share|improve this answer

Your Answer


