Nothing happens upon submission on login page

Results 1 to 2 of 2

Thread: Nothing happens upon submission on login page

  1. #1
    Join Date
    Dec 1969

    Default Nothing happens upon submission on login page

    Why is it that the page simply posts back after i enter a user name, whether it matches in the database or not? Also, the RedirectFromLoginPage should redirect them to the site they were previously at, but what if this is the first site they have been to? heres my code.<BR><BR>&#060;%@ Import Namespace="System.Data" %&#062;<BR>&#060;%@ Import Namespace="System.Data.SQLClient" %&#062;<BR><BR>&#060;Script Runat="Server"&#062;<BR><BR>Sub button_Click (s As Object, e as EventArgs)<BR> If IsValid Then<BR> If DBAuthenticate (txtUserName.text, txtPassword.text) &#062; 0 Then<BR> FormsAuthentication.RedirectFromLoginPage (txtUserName.text, false)<BR> end If<BR> End If<BR>End Sub<BR><BR>Function DBAuthenticate (strUsername As String, strPassword As String) As Integer<BR> Dim conMyData As SqlConnection<BR> Dim cmdSelect As SqlCommand<BR> Dim ParmReturnValue As SqlParameter<BR> Dim intResult as Integer<BR><BR> conMyData = New SqlConnection("Server=localhost;UID=*****;PWD=**** ***;Database=*****")<BR> cmdSelect = New SqlCommand ("DbAuthenticate", conMyData)<BR> cmdSelect.CommandType = CommandType.StoredProcedure<BR> parmReturnValue = cmdSelect.Parameters.Add( "return_value", SqlDBType.Int)<BR> parmReturnValue.Direction = ParameterDirection.ReturnValue<BR> cmdSelect.Parameters.add("@Username", strusername)<BR> cmdSelect.Parameters.add("@password", strpassword)<BR> conMyData.Open()<BR> cmdSelect.ExecuteNonQuery()<BR> intResult = cmdSelect.Parameters("return_value" ).value<BR> conMyData.Close()<BR> if intresult &#060; 0 Then<BR> If intresult = -1 Then<BR> lblmessage.text = "Username not registered!"<BR> else <BR> lblmessage.text = "Invalid Password"<BR> end if<BR> end if<BR> return intResult<BR>End Function <BR>&#060;/script&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default RTFM!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts