1

I have two project solutions. First one is with asp.net (.aspx) web application. The second one is mvc (.cshtml) web application.The first application has a redirect link to second application. The user logins only through the first application. I want to store the user login details and page details of the user in sqlserver using sql server session mode.
Any suggestions will be helpful. Thanks

EDIT
I tried using the sql server session mode from the Link. The session values are stored in the ASPState database.How to check the session is expired and the values are not used from the expired session. ?

1 Answer 1

1

The following code checks for the session expiry.

protected void Page_Init(object sender, EventArgs e)
    {
        if (Context.Session != null)
        {
            if (Session.IsNewSession)
            {
                HttpCookie newSessionIdCookie = Request.Cookies["ASP.NET_SessionId"];
                if (newSessionIdCookie != null)
                {
                    string newSessionIdCookieValue = newSessionIdCookie.Value;
                    if (newSessionIdCookieValue != string.Empty)
                    {
                        // This means Session was timed Out and New Session was started
                        // Do whatever you want
                    }
                }
            }
        }
    }
Sign up to request clarification or add additional context in comments.

Comments

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.