I changed my login page to have a drop down of users and text box for the password. I have the page created where both fields are text boxes and that works fine. However, when i add a drop down and change the txtusername.text to txtusername.selecteditem.text, the page doesn't seem to work completely. If the user types in the wrong password, the "invalid password' prompt appears, but if you enter the right password, it does not take you to the next page. The page simply refreshes. Can anyone find the problem here?


Code:
Sub button_Click (s As Object, e as EventArgs) 

If IsValid Then 

Dim IntUserID as Integer

IntUserID = DBAuthenticate(txtusername.text, txtPassword.text) 

Select Case IntUserID 

Case -1 

LblMessage.text = "Non existent user" 

Case -2

LblMessage.text = "Invalid Password" 

Case Else 

Session("Regionid") = IntUserID 

Session("RegionName") = TxtUsername.text 

response.redirect(return_page)

End Select 

end If 

End Sub 





Sub button_Click2 (s As Object, e as EventArgs)

	response.redirect(back_page)



End Sub





Function DBAuthenticate (strUsername As String, strPassword As String) As Integer 

Dim conMyData As SqlConnection 

Dim cmdSelect As SqlCommand 

Dim ParmReturnValue As SqlParameter 

Dim intResult as Integer 



conMyData = New SqlConnection("Server=localhost;UID=User;PWD=pw;Database=db") 

cmdSelect = New SqlCommand ("DbAuthenticate", conMyData) 

cmdSelect.CommandType = CommandType.StoredProcedure 

parmReturnValue = cmdSelect.Parameters.Add( "return_value", SqlDBType.int) 

parmReturnValue.Direction = ParameterDirection.ReturnValue 

cmdSelect.Parameters.add("@Username", strUserName) 

cmdSelect.Parameters.add("@password", strpassword) 

conMyData.Open() 

cmdSelect.ExecuteNonQuery() 

conMyData.Close() 

intResult = cmdSelect.Parameters("return_value" ).value 

Return IntResult 

End Function