2

I'm trying to use the HttpContext.Current.RewritePath method to serve up different versions of an application to different customers. I would love to be able to look at the HttpContext.Current.Session object to know who it is making the request. Oddly when I go to look at this at the BeginRequest handler, the Session always shows null. I've tried various other events and have had no luck. Any ideas on this?

Oded
  • 489,969
  • 99
  • 883
  • 1,009
Jason Thompson
  • 4,643
  • 5
  • 50
  • 74
  • Are you sure the [`SessionStateModule`](http://msdn.microsoft.com/en-us/library/system.web.sessionstate.sessionstatemodule.aspx) is loaded in your application? I am assuming IIS 7.x, BTW, as you did not specify. – Oded Sep 21 '10 at 18:35

1 Answers1

2

You should look at the ASP.Net Application Life Cycle Overview and the Session State Overview pages on the MSDN.

I believe you can do what you're wanting to do by hooking into the Session_OnStart event, which is fired any time a new session is created.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
Nathan Wheeler
  • 5,896
  • 2
  • 29
  • 48