[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

HttpModule, BeginRequest and session

tao lin

10/4/2006 11:35:00 PM

Hi,

I write a customer HttpModule and want to cache a string inside the user
session on the BeginRequest event. I don't want to use application cache
because it relate on each user session. But I find out that at BeginRequest
event, the HttpApplication.Context.Session is null because it's too early to
access the session state. I don't want to use the AcquireRequestState event
to cache the string because it's too late for me.

Anyway I can cache a string in somewhere (not in HttpApplication.Cache) at
the BeginRequest event?

Cheers,

Tao


1 Answer

offwhite

10/6/2006 6:22:00 PM

0

Try this reference...

HttpContext.Current.Session

That should not be null. Also, consider doing something with the
Session_Start method in Global.asax. That will surely have a session.
If you just need to drop something in there once per session, that is
the proper place to do it.

Unfortunately you can only access Session_Start from Global.asax and
not Http Modules.

More here...

http://msdn2.microsoft.com/en-us/library/ms1...

Brennan Stehling
http://brennan.offwhite...

tao lin wrote:
> Hi,
>
> I write a customer HttpModule and want to cache a string inside the user
> session on the BeginRequest event. I don't want to use application cache
> because it relate on each user session. But I find out that at BeginRequest
> event, the HttpApplication.Context.Session is null because it's too early to
> access the session state. I don't want to use the AcquireRequestState event
> to cache the string because it's too late for me.
>
> Anyway I can cache a string in somewhere (not in HttpApplication.Cache) at
> the BeginRequest event?
>
> Cheers,
>
> Tao