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

  • Thread starter Thread starter Ryan Liu
  • Start date Start date
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
 
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/
=========================
 
Back
Top