HttpContext.Current is static, so it is global? Then How it works for pre request? Like Thread.Curre

R

Ryan Liu

HttpContext.Current is static, so it is global?

Just curious, how can it work pre request?

Or like Thread.CurrentThread, only one current HttpContext at a time, for
different request, it was switcheed to different context instance?

So should say one current HttpContext pre working tread, if asp.net uses
multiple thread to process the request?

Because of this switching, HttpContext can be per request thing, e.g.
created for each request.

(then how its Session property works?)

Thanks,
Ryan
 
J

Juan T. Llibre

re:
!> like Thread.CurrentThread, only one current HttpContext at a time,
!> for different request, it was switched to different context instance?

Exactly...

re:
!> then how its Session property works?

You can assign any content in HttpContext.Current to a session variable.

HttpContext.Current.Session("Variable1")





Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
=========================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top