MarcGraff
asked on
ASP.NET: Using a Cookie
I have an internal login page where I need to be able to use a Cookie (or something) else to Save the user name and password when the user chenck a textbox then logs in.
Thanks!
- Marc
Thanks!
- Marc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
I'm not working with cookies anymore! -> I work "cookieless" ;-))
I save the Session GUID to the database -> as long as the user stays in that session I can track anything happening -> the rest (information management) is done by "user" classes -> one for logon another one for having access to user profile and so on ...
After accessing the website the user sees the following (as an example!) http://www.w62.net/(knmqwfv3smmyruajhg2juc2b)/Default.aspx
Everything is kept in the database with that key "knmqwfv3smmyruajhg2juc2b" -> and some more security features ;-))
... are you interested in that technology or are you going to accept the link above?
Best regards, Raisor
I'm not working with cookies anymore! -> I work "cookieless" ;-))
I save the Session GUID to the database -> as long as the user stays in that session I can track anything happening -> the rest (information management) is done by "user" classes -> one for logon another one for having access to user profile and so on ...
After accessing the website the user sees the following (as an example!) http://www.w62.net/(knmqwfv3smmyruajhg2juc2b)/Default.aspx
Everything is kept in the database with that key "knmqwfv3smmyruajhg2juc2b"
... are you interested in that technology or are you going to accept the link above?
Best regards, Raisor
ASKER
Raisor:
I love your pitch on "cookieless"...
How does the database get information back after the user logs off and logs on the next day?
- Marc
I love your pitch on "cookieless"...
How does the database get information back after the user logs off and logs on the next day?
- Marc
ASKER
BTW Sorry about the time delay but I am still trying to get it all to work.
- Marc
- Marc
Hi,
Here we go:
-> the user comes as visitor to the site
-> the visitor is attached to a session GUID
-> if visitor logs on successfully the visitor is attached to the user ID
-> if user doesn't log on the visitor remains attached to session GUID
-> if visitor returns any other time the user is attached to a new session GUID
-> if visitor logs on successfully after any other return the user is attached to the user ID
What is this good for? ->
Many users have cookies disabled ... I have statistics from many sites of mine about this issue!
So any specific user information that is necessary to process your web sites critical business processes will be blown to air if you only depend on cookies and cookies are disabled!
I used to send visitors without cookies enabled to http://www.visitors-without-enabled-cookies.com trying to convince them there to enable cookies -> I tell you … that didn’t work at all and in the meantime I dropped that domain!
Here is one part of code from a Page_Load event that documents a basic how-to (and show which information I pick from unknown visitors!) …
If Page.IsPostBack = False Then
If Not Request.ServerVariables("H TTP_ASPFIL TERSESSION ID") Is Nothing Then
myGuestID = Request.ServerVariables("H TTP_ASPFIL TERSESSION ID").ToStr ing
Dim [myDB] As New snifferDB()
If [myDB].CheckVisitorCount(m yGuestID) = 0 Then
If Not Request.ServerVariables("R EMOTE_ADDR ") Is Nothing Then
myVisitorIP = Request.ServerVariables("R EMOTE_ADDR ").ToStrin g
Else
myVisitorIP = "0.0.0.0"
End If
If Not Request.ServerVariables("H TTP_REFERE R") Is Nothing Then
myVisitorREF = Request.ServerVariables("H TTP_REFERE R").ToStri ng
Else
myVisitorREF = "From Heaven"
End If
myVisitorDLang = 0
Dim [myTime] As New TimeFunction()
myVisitorTime = [myTime].Generate_Timestam p(Day(Now) , Month(Now), Year(Now), Hour(Now), Minute(Now), Second(Now))
[myTime] = Nothing
myVisitorSession = myGuestID
Dim myInterestBuffer As New webactBuffer()
myInterestBuffer.theIP = myVisitorIP
myInterestBuffer.theRef = myVisitorREF
myInterestBuffer.theDLang = myVisitorDLang
myInterestBuffer.theSLang = myVisitorSLang
myInterestBuffer.theSDiale ct = myVisitorSDialect
myInterestBuffer.theTime = myVisitorTime
myInterestBuffer.theSessio n = myVisitorSession
Dim myInterest As Boolean = myDB.AddActData(1, myInterestBuffer)
myInterestBuffer = Nothing
myInterest = Nothing
End If
[myDB] = Nothing
End If
End If
End Sub
This all relies on HTTP_ASPFILTERSESSIONID and this is the setting in "web.config" to retrieve cookieless state:
<sessionState
mode="InProc"
stateConnectionString="tcp ip=127.0.0 .1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="true"
timeout="20"
/>
Please take this piece of code only as is … if you’re further interested I’ll prepare some more for you!
Best regards, Raisor
Here we go:
-> the user comes as visitor to the site
-> the visitor is attached to a session GUID
-> if visitor logs on successfully the visitor is attached to the user ID
-> if user doesn't log on the visitor remains attached to session GUID
-> if visitor returns any other time the user is attached to a new session GUID
-> if visitor logs on successfully after any other return the user is attached to the user ID
What is this good for? ->
Many users have cookies disabled ... I have statistics from many sites of mine about this issue!
So any specific user information that is necessary to process your web sites critical business processes will be blown to air if you only depend on cookies and cookies are disabled!
I used to send visitors without cookies enabled to http://www.visitors-without-enabled-cookies.com trying to convince them there to enable cookies -> I tell you … that didn’t work at all and in the meantime I dropped that domain!
Here is one part of code from a Page_Load event that documents a basic how-to (and show which information I pick from unknown visitors!) …
If Page.IsPostBack = False Then
If Not Request.ServerVariables("H
myGuestID = Request.ServerVariables("H
Dim [myDB] As New snifferDB()
If [myDB].CheckVisitorCount(m
If Not Request.ServerVariables("R
myVisitorIP = Request.ServerVariables("R
Else
myVisitorIP = "0.0.0.0"
End If
If Not Request.ServerVariables("H
myVisitorREF = Request.ServerVariables("H
Else
myVisitorREF = "From Heaven"
End If
myVisitorDLang = 0
Dim [myTime] As New TimeFunction()
myVisitorTime = [myTime].Generate_Timestam
[myTime] = Nothing
myVisitorSession = myGuestID
Dim myInterestBuffer As New webactBuffer()
myInterestBuffer.theIP = myVisitorIP
myInterestBuffer.theRef = myVisitorREF
myInterestBuffer.theDLang = myVisitorDLang
myInterestBuffer.theSLang = myVisitorSLang
myInterestBuffer.theSDiale
myInterestBuffer.theTime = myVisitorTime
myInterestBuffer.theSessio
Dim myInterest As Boolean = myDB.AddActData(1, myInterestBuffer)
myInterestBuffer = Nothing
myInterest = Nothing
End If
[myDB] = Nothing
End If
End If
End Sub
This all relies on HTTP_ASPFILTERSESSIONID and this is the setting in "web.config" to retrieve cookieless state:
<sessionState
mode="InProc"
stateConnectionString="tcp
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="true"
timeout="20"
/>
Please take this piece of code only as is … if you’re further interested I’ll prepare some more for you!
Best regards, Raisor
ASKER
I love this method even though I don't completly understand it. I would love to learn more about it so I created another question:
https://www.experts-exchange.com/questions/20818484/Saveing-web-data-without-using-cookies.html
I will have to use cookies while I learn "The Raisor" method but look forward to implementing "The Raisor" method in my next ASP page!
- Marc
https://www.experts-exchange.com/questions/20818484/Saveing-web-data-without-using-cookies.html
I will have to use cookies while I learn "The Raisor" method but look forward to implementing "The Raisor" method in my next ASP page!
- Marc
http://www.gotdotnet.com/team/student/wintellect/aspnet_tutorial.aspx
B..G