Click here to Skip to main content
14,870,621 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have a small web application with a login page and default page with forms authentication set up exactly ASP.NET Forms Authentication .

Now on the default page i have a SQL Query to retrieve EmailID of logged user like
Select EmailID from users where username = "LoggedUser"

how can i pass logged user value from my cookie to loggeduser variable of my SQL Query ?

What I have tried:

Earlier i was using custom authentication like i will store
session("Loggeduser") = txtusername.text
then retrieve it into SQL query and everything works fine. later i found that method is not safe as client may be able to manipulate and login with someone else's username.
Updated 21-Feb-20 21:45pm

1 solution

See here: HttpRequest.Cookies Property (System.Web) | Microsoft Docs[^]

But ... this is web based so if you have any European Union users then GDPR applies and that means you need to obtain permission from the user to use them.

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