I’m using default ASP.NET user controls and SQL user provider.
How can I log somewhere when users login to web and when logout ?
Is there some tricks for it or just write to some .log file manually each time after user login. (Also , how can I check user IP adress ?)
Thank you.
The ASP.NET
Logincontrol has aLoggedInevent that you can add a handler for that does whatever you like, such as log it somewhere. Similarly, theLoginStatuscontrol has aLoggedOutevent.The User IP address is available using the HttpContext:
HttpContext.Current.Request.UserHostAddress;orHttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];