Änderung der Webconfig

This commit is contained in:
ja
2021-10-21 16:22:45 +02:00
parent d336d2d3c6
commit 51a84e3b33
5 changed files with 33 additions and 23 deletions

View File

@@ -4,16 +4,23 @@ Imports System.Data
Partial Class login_FLEX
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
If Me.Page.User.Identity.IsAuthenticated Then
Response.Redirect("../Customers/Welcome.aspx")
End If
If Not Me.Page.User.Identity.IsAuthenticated Then
FormsAuthentication.RedirectToLoginPage()
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
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
'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
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
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
@@ -115,7 +122,7 @@ Partial Class login_FLEX
' 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 UserId,Username, Password FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND Password=@Password AND UserId=@KundenNr")
Using cmd As New SqlCommand("SELECT UserId,Username,Password FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND Password=@Password AND UserId=@KundenNr")
' cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@Username", UserNaMe)
cmd.Parameters.AddWithValue("@KundenNr", Customer_ID)
@@ -136,22 +143,22 @@ Partial Class login_FLEX
Exit Select
Case Else
If tb.Text = dr("UserId") Then
Customer_ID = dr("UserId")
Customer_ID = dr("UserId").ToString
Else
Login1.FailureText = "ID cannot be found in the database!"
End If
If tb2.Text = dr("Username") Then
Customer_ID = dr("Username")
UserNaMe = dr("Username").ToString
Else
Login1.FailureText = "Username is not in the database!"
End If
If tb3.Text = dr("Password") Then
Customer_ID = dr("Password")
passw = dr("Password").ToString
Else
Login1.FailureText = "Password is not in the database!"
End If
Login1.FailureText = "Erfolgreich validiert."
MsgBox("Erfolgreich validiert.")
Session.Add("test", UserNaMe)
Session.Add("UserID", Customer_ID)
Session.Add("PW", passw)
@@ -166,7 +173,7 @@ Partial Class login_FLEX
con.Close()
End Using
End Using
MsgBox("Wow1")
MsgBox("Wow1" + Environment.NewLine + Customer_ID + Environment.NewLine + UserNaMe + Environment.NewLine + passw)
Page.Response.Redirect("../Customers/CustomsAviso.aspx")
End Sub