How do I access the session in order to do a rewrite?
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 g开发者_如何学运维o 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?
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.
精彩评论