first git
This commit is contained in:
46
login/login_TEST.aspx.vb
Normal file
46
login/login_TEST.aspx.vb
Normal file
@@ -0,0 +1,46 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Data
|
||||
|
||||
Partial Class login_login_TEST
|
||||
Inherits System.Web.UI.Page
|
||||
|
||||
|
||||
Protected Sub ValidateUser(sender As Object, e As EventArgs)
|
||||
Dim userId As Integer = 0
|
||||
' cDBFunctions.GetNewOpenConnection()
|
||||
Dim ConnectionString = ""
|
||||
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
|
||||
ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
|
||||
Else
|
||||
ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
|
||||
End If
|
||||
|
||||
' Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
|
||||
Using con As New SqlConnection(ConnectionString)
|
||||
Using cmd As New SqlCommand("Validate_User")
|
||||
cmd.CommandType = CommandType.StoredProcedure
|
||||
cmd.Parameters.AddWithValue("@Username", Login1.UserName)
|
||||
cmd.Parameters.AddWithValue("@Password", Login1.Password)
|
||||
cmd.Connection = con
|
||||
con.Open()
|
||||
userId = Convert.ToInt32(cmd.ExecuteScalar())
|
||||
con.Close()
|
||||
End Using
|
||||
Select Case userId
|
||||
Case -1
|
||||
Login1.FailureText = "Username and/or password is incorrect."
|
||||
Exit Select
|
||||
Case -2
|
||||
Login1.FailureText = "Account has not been activated."
|
||||
Exit Select
|
||||
Case Else
|
||||
FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet)
|
||||
'FormsAuthentication.SetAuthCookie(Login1.UserName, True)
|
||||
'Response.Redirect("mypage.aspx")
|
||||
Exit Select
|
||||
End Select
|
||||
End Using
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user