0

When I start the application, I set a session variable. I'd like on each action (each controller action) check if this variable is still available or/and Session is null if it's the case redirect the action to /Account/LogOn

I tried using Application_BeginRequest but without success. I think there is a problem with the cycle (how is done first) Session_Start, Application_Start, ...

Do you have an idea how I can do ?

Thanks,

1 Answer 1

1

Checking prerequest on Global.asx.cs may work.

    protected void Application_PreRequestHandlerExecute(object sender, EventArgs e)
    {
         //Check session value  
    }
Sign up to request clarification or add additional context in comments.

1 Comment

Trying to redirect from this to /Account/LogOn. I use the code gave by Darin Dimitrov stackoverflow.com/questions/6703516/… but the result is a page with a screen with the LogOn page and under the About page (I clicked on the About menu)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.