CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Autologin on Login page VB.NET

Print topic Send  topic

Author Message
rclayh
Posted: 10/15/2003, 12:00 PM

Okay, I found how to get the windows login name, so now I want to be able to use that authenticated login to automatically login the user on my web application if the username is in the database otherwise I want them to get the login form. So does anyone know how I can load the login form, test to see if the username is in the database and then autolog them in. What event should I hook into? Use a response.redirect?

Thanks in advance.
rclayh
Posted: 10/16/2003, 6:34 AM

Figured it out, and it's pretty simple really. You just add slightly modified login form code in the before show event of the login page. Here's what my code ended up looking like if anyone is interested...

'Autologin if possible
'Build the windows user name
Dim CurrentUser as String = Web.HttpContext.Current.User.Identity.Name.ToString()
'Need to split the CurrentUser at the \
Dim myIndex as Integer = CurrentUser.IndexOf("\")
CurrentUser = CurrentUser.Remove(0,myIndex + 1)
Dim myUserPassword as String = Settings.conHelpDeskSQLDataAccessObject.ExecuteScalar("SELECT UserPassword FROM Personnel WHERE UserName='"& CurrentUser & "'").ToString
If DBUtility.CheckUser(CurrentUser, myUserPassword) Then
If Not(HttpContext.Current.Request("ret_link") is Nothing) Then
If Not(HttpContext.Current.Request("ret_link")="") Then
Response.Redirect(HttpContext.Current.Request("ret_link"))
End If
End If
End If

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.