**DEVILZ**
New Member
Has anyone done forms authentication by checking the database for the userid and password?<BR>if yes, can u help me out with either the code or hint?<BR>thx<Script language="vb" runat="server"><BR>Sub DoLogin(objSender as Object, objArgs as EventArgs)<BR> dim userid = txtUser.Text<BR> dim password = txtPwd.Text<BR> dim isAuthenticated as Boolean = False<BR> dim rememberLogin as Boolean = chkRemember.checked<BR> <BR> Dim dbcon As New SqlConnection(ConfigurationSettings.AppSettings("DSN")) ' i stored dsn in web.config<BR><BR> Dim cmd as SqlCommand = new SqlCommand("sp_Login_Authenticate '" & userid & "'", dbcon) 'i have a stored procedure which basically does "select userid, password, and_other_stuff from [user] where userid = the_value_you_entered'<BR><BR> dbcon.open()<BR> dim dr as SqlDataReader = cmd.ExecuteReader()<BR> do while dr.read()<BR> userid = dr("userid")<BR> Session("Name") = dr("Name") 'i grab user info for using while he is on the site<BR> Session("email") = dr("Email")<BR> if password = dr("password") then isAuthenticated = True<BR> loop<BR> <BR> If isAuthenticated Then<BR> FormsAuthentication.RedirectFromLoginPage(userid, rememberLogin)<BR> else<BR> msgStatus.InnerHTML = userid & " failed authentication"<BR> end if<BR>End Sub<BR></Script><BR><BR>My web.config includes:<BR> <appSettings><BR> <add key="DSN" value=http://aspmessageboard.com/archive/index.php/"server=localhost;uid=anton;pwd=blahblah;database=m yblahDb" /><BR> </appSettings><BR><BR>EnjoyUsing Forms Authentication in ASP.NET<BR>http://www.4guysfromrolla.com/webtech/110701-1.shtml<BR><BR>Happy Programming!