Click here to Skip to main content
16,009,318 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello all , I have a web app with few web forms and I’m removed form authentication in web.config file.

May I know is it safe to use session variable to store logged user data ?

Ex: session(“loggeduser”) = “John”
session(“loggeduserID”) = “123”

What I have tried:

Up on user login with login page , I store userID and user name as session(“loggeduserID”) = “123”, then on each I’m checking if session(“loggeduserID”) is having a value. It will redirect to login page if there is no value .

Also session having a userID , it will check SQL database to check if there is an entry in database for the specific user for the specific form name .

Currently everything works smooth and ok , is it safe to use user authentication to each form with the value stored in session(“x”) ?
Posted
Comments
ZurdoDev 24-Feb-20 7:26am    
If you do it that way, you have to make sure you check each and every request for your own authentication token (in this case your session value.)
SulfySul 28-Feb-20 0:53am    
yes i am doing so, is it possible for users from client side to modify my session value ?
ZurdoDev 28-Feb-20 6:50am    
Not really. Session is managed on the server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900