How to save session id and validate it with another session id when user log in to the application from new browser

Tushar Gupta 1 Reputation point
2024-03-29T08:17:36.3533333+00:00

Hi Support,

I want to save the UserId and SessionID. When the user logs into the application with the same URL in another browser then I need to validate that the SessionID is not the same when logging into the application in another browser.

I tried saving the SessionID in sessions but when the user logs in to the application from another browser the session gets null so I couldn't validate it from the current SessionId.

The same happened with the cookies as well.

Problem Remediation:
"User cookies should be validated during login to the application and if there is an existing session with the same cookie, then try to assign a new session cookie and Validate the user credential again."

https://owasp.org/www-community/attacks/Session_hijacking_attack

Please suggest a solution.

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,256 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,031 Reputation points
    2024-04-05T21:48:24.6433333+00:00

    by default, the session id is stored in a session only cookie (only current browser instance and not saved to persist store) as is the Authentication token. this means two browser instances will have two sessions in asp.net. two tabs in the same instance will share session and authentication cookies.

    you should be using ssl to prevent man in the middle attacks and session sniffing.

    0 comments No comments