Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AuthenticateRequest vs PostAuthenticateRequest + Session

we're having a problem using the AuthenticateRequest for a Custom-Control: For persisting informations we're using the HttpContext.Current.Application.

For various Reasons, this is not working so proper, if multiple users are working in the same time, since the application key is not conclusively.

The problem: The persisting happens in the AuthenticateRequest-event, where the Session can't be accessed as far as I know. I searched a bit and found the PostAuthenticateRequest-event and the description about the difference here: http://leastprivilege.com/2006/07/02/authenticaterequest-vs-postauthenticaterequest/

Sadly, I still can't access the Session, HttpApplication throws a error:

{"Session state is not available in this context."}

And HttpApplication.Context.Session keeps getting NULL.

Is there anyhow a possibility to get the Session at this Point? Or is there another Event I could use, which would serve the same purpose?

Thanks in advance.

Matthias

Edith: I found out that the Header is lost between MapRequestHandler (Header set) and PostMapRequestHandler (Header not set)

like image 331
Matthias Müller Avatar asked Dec 06 '25 20:12

Matthias Müller


1 Answers

Your problem is that PostAuthenticateRequest occurs earlier in the pipeline, that is before AcquireRequestState is called. In order to access session state you need that event to execute and should look towards events later in the lifecycle. If you a re not familiar with the event sequence have a look here...

like image 88
Sarel Esterhuizen Avatar answered Dec 08 '25 09:12

Sarel Esterhuizen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!