I'm trying to find a way to extract the username from a cookie when it is generated. What I mean is the "whatever" in firstname.lastname@example.org that is stored as the cookie name. I want to use this in an intranet application to recognize the users automatically without having them create a username and password for my site. Can this be done?
this will place a cookie on the users machine, gives the cookie an ID number, sets the cookie to expire in the future so that you get a physical cookie and not a memory resilient one and then sets the variable Username.
did you go to your cookie folder and look for the cookie?
Try open the cookie if you did find it see if the variable username is there and it is equal to the username you specified in this line.
Response.Cookies("HSEuser")("UserName") = "David"
Response.Cookies("HSEuser")("UserName") = "NatuScape"
Username = "NatuScape"
if there is no cookie then check your settings make sure you have cookies enabled.
Also try write information to cookies before any HTML has been writen to screen.
You should have this code in your global.asa Sub On Sessions_Start, then you can use session variables to pass the username around the site
The catch here is that I don't want to tell the cookie what username to use, but rather catch that from the environment, given that the user has already logged on to the NT network. Is there any way I can recover that info from the cookie's filename? I tried stuff like Request.ServerVariables("LOGON_USER") and Request.ServerVariables("AUTH_USER"), but those don't work either.
i think i get what you're trying to do here, but just let me check. You are building an Intranet that you want to be secure. You want to allow access to the network users but you don't want them to have to login every time or having to create a username and password to even start with. You want access to be granted based on username but you don't want to write the username to a cookie.
The users log on to the NT network, and I'm guessing the username gets stored somewhere on the computer because the browser uses that information to compose the filename for the cookie (email@example.com).