1
votes

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

1 Answers

1
votes

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
                    }
                }
            }
        }
    }