68 lines
3.0 KiB
VB.net
68 lines
3.0 KiB
VB.net
Imports System.Data.SqlClient
|
|
Imports System.Data
|
|
|
|
Partial Class login_FLEX
|
|
Inherits System.Web.UI.Page
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs)
|
|
If Not Page.IsPostBack Then
|
|
Page.Validate()
|
|
End If
|
|
End Sub
|
|
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"
|
|
ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
Else
|
|
ConnectionString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
'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")
|
|
Using cmd As New SqlCommand("SELECT COUNT(*) FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND Password=@Password")
|
|
' 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())
|
|
Dim dr As SqlDataReader = cmd.ExecuteReader()
|
|
If dr.HasRows Then
|
|
dr.Read()
|
|
'MsgBox(dr.Item(0).ToString())
|
|
Select Case dr.Item(0)
|
|
Case 0
|
|
Login1.FailureText = "Benuzername und/oder das Passwort stimmen nicht überein."
|
|
Exit Select
|
|
Case -2
|
|
Login1.FailureText = "Account ist nicht freigeschaltet."
|
|
Exit Select
|
|
Case Else
|
|
Login1.FailureText = "Erfolgreich validiert."
|
|
Session.Add("test", Login1.UserName)
|
|
|
|
Session.Add("PW", Login1.Password)
|
|
|
|
FormsAuthentication.RedirectFromLoginPage(Login1.UserName, True)
|
|
|
|
'FormsAuthentication.SetAuthCookie(Login1.UserName, True)
|
|
'Response.Redirect("../Customers/CustomsAviso.aspx")
|
|
Exit Select
|
|
End Select
|
|
End If
|
|
dr.Close()
|
|
con.Close()
|
|
End Using
|
|
End Using
|
|
End Sub
|
|
|
|
Protected Sub LoginButton_Click(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
End Class
|