ASP.NET_SessionId

Larissa Pereira 1 Reputation point
2021-09-20T11:15:42.687+00:00

i want to secure 'ASP.NET_SessionId' cookie, so i added

<httpCookies httpOnlyCookies="true" requireSSL="true"/> to web.config and

Response.Cookies[ASP.NET_SessionId].Secure = true; to master page.

However when i add code to master page my session gets lost.
Need help

Developer technologies ASP.NET ASP.NET Core
Developer technologies ASP.NET Other
{count} votes

1 answer

Sort by: Most helpful
  1. Sam Wu-MSFT 7,561 Reputation points Microsoft External Staff
    2021-09-21T03:15:39.787+00:00

    Hi @Larissa Pereira

    Try to set the Response.Cookies ["ASP.NET_SessionID"].Secure = true in the Session_Start of the global.asax instead of master page.

    133786-capture.png


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.