locked
ASP.NET Session State with SQL Server In-Memory RRS feed

  • Question

  • User120020449 posted

    Hi,
    I am trying to implement ASP.NET async SQL Session State provider in our application.
    https://blogs.msdn.microsoft.com/sqlserverstorageengine/2017/11/28/asp-net-session-state-with-sql-server-in-memory-oltp/

    We have created a sample application to implement this feature. But we are facing some issues with 'Session.Abandon()'.

    In the sample application attached, when we click on 'Login' button, the page will be redirected to 'Default.aspx' page. On 'Default.aspx' page, when we click on 'Session Abandon' button page will be redirected to 'Login.aspx' page.
    While clicking on 'Session Abandon' button, 'Session.Abandon()' is fired.

    When 'sessionState' mode is set to 'Custom',
    On 'Session_Start(object sender, EventArgs e)' event in 'Global.asax' page, the "HttpContext.Current" becomes NULL.
    In this case, if we are using 'Session.Clear()' instead of 'Session.Abandon()' its working fine.
    Could you please provide the reason for why "HttpContext.Current" becomes NULL when 'Session.Abandon()' is used. Also please provide a solution to overcome this issue?

    When 'sessionState' mode is set to 'SQLServer',
    "HttpContext.Current" is not null.

    Please find the sample application from the following link
    https://drive.google.com/open?id=1oThUUiigcGR9NK6Y65JFnoociiVVjzxT

    Can anyone suggest a solution for this?

    Thanks in advance.

    Friday, August 24, 2018 1:12 PM

All replies

  • User283571144 posted

    Hi J47,

    According to application I have run the application you have provided.

    If I set the session state to custom, it shows the "Parser Error Message: Provider must implement the class 'System.Web.SessionState.SessionStateStoreProviderBase'". error.

    If I used the SQLServer mode, it works well.

    Httpcontext is not null.

    Could you please show more details about how you implement the SessionStateStoreProviderBase class?

    If you could provide more details information, it will be more easily for us to find the reason and find the solution.

    Best Regards,

    Brando

    Monday, August 27, 2018 10:09 AM
  • User120020449 posted

    Hi Brando,

    Thanks for your response.

    Navigate to the web project. Click -> 'F4' button. Then change 'Managed Pipeline mode' to 'Integrated'.

    Or please check the application from following link.

    https://drive.google.com/open?id=1GalY5wh-w20h9fJGgvpI1d23PVLEM6bO

    Let me know if it works.

    Thanks,

    Monday, August 27, 2018 1:50 PM
  • User187772904 posted

    thanks for your answer

    Tuesday, September 4, 2018 8:02 AM