Loginf funktioniert jetzt wieder!
This commit is contained in:
24
Global.asax
24
Global.asax
@@ -5,15 +5,15 @@
|
||||
void Application_Start(object sender, EventArgs e)
|
||||
{
|
||||
// Code, der beim Anwendungsstart ausgeführt wird
|
||||
// Code that runs on application startup
|
||||
ScriptManager.ScriptResourceMapping.AddDefinition("jquery",
|
||||
new ScriptResourceDefinition
|
||||
{
|
||||
Path ="https://code.jquery.com/jquery-3.5.1.min.js",
|
||||
DebugPath = "~/scripts/jquery-1.7.2.js",
|
||||
CdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.min.js",
|
||||
CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.js"
|
||||
});
|
||||
// Code that runs on application startup
|
||||
ScriptManager.ScriptResourceMapping.AddDefinition("jquery",
|
||||
new ScriptResourceDefinition
|
||||
{
|
||||
Path ="https://code.jquery.com/jquery-3.5.1.min.js",
|
||||
DebugPath = "~/scripts/jquery-1.7.2.js",
|
||||
CdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.min.js",
|
||||
CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.js"
|
||||
});
|
||||
}
|
||||
|
||||
void Application_End(object sender, EventArgs e)
|
||||
@@ -33,7 +33,9 @@
|
||||
void Session_Start(object sender, EventArgs e)
|
||||
{
|
||||
// Code, der ausgeführt wird, wenn eine neue Sitzung gestartet wird
|
||||
|
||||
FormsAuthenticationTicket formsAuthenticationTicket = new FormsAuthenticationTicket(2,"ticket",DateTime.Now,DateTime.Now.AddMinutes(-30),true,"Par1="+Session.SessionID.ToString());
|
||||
FormsAuthentication.Encrypt(formsAuthenticationTicket);
|
||||
FormsAuthentication.RenewTicketIfOld(formsAuthenticationTicket);
|
||||
}
|
||||
|
||||
void Session_End(object sender, EventArgs e)
|
||||
@@ -48,7 +50,5 @@
|
||||
Session.Remove("UserID");
|
||||
Session.Remove("test");
|
||||
Session.Remove("PW");
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
10
Web.config
10
Web.config
@@ -123,5 +123,15 @@
|
||||
<add key="ClientValidationEnabled" value="true"/>
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
|
||||
</appSettings>
|
||||
<location path="Customers">
|
||||
<system.web>
|
||||
<authorization>
|
||||
<allow users="?"/>
|
||||
<!--A question mark (?) denies anonymous users-->
|
||||
</authorization>
|
||||
</system.web>
|
||||
</location>
|
||||
</configuration>
|
||||
<!--ProjectGuid: 9b651bc0-361a-4f93-8118-dd8a986f2371-->
|
||||
<!--Deny access for 'images' folder-->
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@ 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")
|
||||
Response.Redirect("../Customers/Welcome.aspx", False)
|
||||
End If
|
||||
If Not Me.Page.User.Identity.IsAuthenticated Then
|
||||
FormsAuthentication.RedirectToLoginPage()
|
||||
Response.End()
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub ValidateUser(sender As Object, e As EventArgs)
|
||||
@@ -43,6 +44,8 @@ Partial Class login_FLEX
|
||||
Dim regexuserID_M As RegularExpressionValidator = Login2.FindControl("valid_getNumber_M_Input")
|
||||
Dim regexusername As RegularExpressionValidator = Login1.FindControl("check_UserName_regex")
|
||||
Dim regexusername_M As RegularExpressionValidator = Login2.FindControl("check_UserName_M_regex")
|
||||
Dim cb As CheckBox = Login1.FindControl("RememberMe")
|
||||
Dim cb_M As CheckBox = Login2.FindControl("RememberMe_M")
|
||||
|
||||
Dim Customer_ID As String = String.Empty
|
||||
Dim UserNaMe As String = String.Empty
|
||||
@@ -81,7 +84,7 @@ Partial Class login_FLEX
|
||||
If regexusername.IsValid Then
|
||||
UserNaMe = tb2.Text
|
||||
Else
|
||||
regexusername_M.ErrorMessage = "Username doeas not have any special chaaracters in it."
|
||||
regexusername_M.ErrorMessage = "Username does not have any special chaaracters in it."
|
||||
End If
|
||||
Else
|
||||
reqfieldvaluserName.ErrorMessage = "Username has to be given."
|
||||
@@ -99,31 +102,24 @@ Partial Class login_FLEX
|
||||
regexusername.ErrorMessage = "Password has to match the criterias of tge info button."
|
||||
End If
|
||||
End If
|
||||
If String.IsNullOrEmpty(tb3_M.Text) = False AndAlso String.IsNullOrEmpty(tb3.Text) = True Then
|
||||
reqfieldvalpassw.Enabled = True
|
||||
reqfieldvalpassw_M.Enabled = False
|
||||
|
||||
reqfieldvalpassw.Validate()
|
||||
If reqfieldvalpassw.IsValid = True Then
|
||||
End If
|
||||
passw = tb3.Text
|
||||
End If
|
||||
If String.IsNullOrEmpty(tb3.Text) = False AndAlso String.IsNullOrEmpty(tb3_M.Text) = True Then
|
||||
reqfieldvalpassw.Enabled = True
|
||||
reqfieldvalpassw_M.Enabled = False
|
||||
|
||||
reqfieldvalpassw.Validate()
|
||||
If reqfieldvalpassw.IsValid = True Then
|
||||
End If
|
||||
passw = tb3_M.Text
|
||||
End If
|
||||
End If
|
||||
If String.IsNullOrEmpty(tb3.Text) = False AndAlso String.IsNullOrEmpty(tb3_M.Text) = True Then
|
||||
reqfieldvalpassw.Enabled = True
|
||||
reqfieldvalpassw_M.Enabled = False
|
||||
reqfieldvalpassw.Validate()
|
||||
If reqfieldvalpassw.IsValid = True Then
|
||||
passw = tb3.Text
|
||||
End If
|
||||
End If
|
||||
If String.IsNullOrEmpty(tb3_M.Text) = False AndAlso String.IsNullOrEmpty(tb3.Text) = True Then
|
||||
reqfieldvalpassw.Enabled = False
|
||||
reqfieldvalpassw_M.Enabled = True
|
||||
|
||||
reqfieldvalpassw_M.Validate()
|
||||
If reqfieldvalpassw_M.IsValid = True Then
|
||||
passw = tb3_M.Text
|
||||
Else
|
||||
reqfieldvalpassw_M.ErrorMessage = "Please insert your personal passowrd."
|
||||
End If
|
||||
End If
|
||||
' Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
|
||||
@@ -169,7 +165,7 @@ Partial Class login_FLEX
|
||||
Session.Add("test", UserNaMe)
|
||||
Session.Add("UserID", Customer_ID)
|
||||
Session.Add("PW", passw)
|
||||
FormsAuthentication.RedirectFromLoginPage(UserNaMe, True)
|
||||
|
||||
|
||||
'FormsAuthentication.SetAuthCookie(Login1.UserName, True)
|
||||
'Response.Redirect("../Customers/CustomsAviso.aspx")
|
||||
@@ -180,41 +176,18 @@ Partial Class login_FLEX
|
||||
con.Close()
|
||||
End Using
|
||||
End Using
|
||||
MsgBox("Wow1" + Environment.NewLine + Customer_ID + Environment.NewLine + UserNaMe + Environment.NewLine + passw)
|
||||
Page.Response.Redirect("../Customers/CustomsAviso.aspx")
|
||||
|
||||
If String.IsNullOrEmpty(tb2_M.Text) = False AndAlso String.IsNullOrEmpty(tb2.Text) = True Then
|
||||
FormsAuthentication.SetAuthCookie(Login1.UserName, cb_M.Checked)
|
||||
ElseIf String.IsNullOrEmpty(tb2.Text) = False AndAlso String.IsNullOrEmpty(tb2_M.Text) = True Then
|
||||
FormsAuthentication.SetAuthCookie(Login2.UserName, cb.Checked)
|
||||
End If
|
||||
FormsAuthentication.RedirectFromLoginPage(UserNaMe, True)
|
||||
End Sub
|
||||
|
||||
Protected Sub LoginButton_Click(sender As Object, e As EventArgs)
|
||||
Validate("Login")
|
||||
If Page.IsValid() Then
|
||||
MsgBox("Wow1")
|
||||
Dim cb As CheckBox = Page.FindControl("RememberMe")
|
||||
If cb.Checked = True Then
|
||||
FormsAuthentication.SetAuthCookie(Login1.UserName, True)
|
||||
Else
|
||||
FormsAuthentication.SetAuthCookie(Login1.UserName, False)
|
||||
End If
|
||||
Response.Redirect("../Customers/CustomsAviso.aspx")
|
||||
Else
|
||||
MsgBox("Error1")
|
||||
Response.Redirect("login_FLEX.aspx")
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub LoginButton_M_Click(sender As Object, e As EventArgs)
|
||||
Validate("Login_M")
|
||||
If Page.IsValid() Then
|
||||
MsgBox("Wow2")
|
||||
Dim cb As CheckBox = Page.FindControl("RememberMe_M")
|
||||
If cb.Checked = True Then
|
||||
FormsAuthentication.SetAuthCookie(Login1.UserName, True)
|
||||
Else
|
||||
FormsAuthentication.SetAuthCookie(Login1.UserName, False)
|
||||
End If
|
||||
Response.Redirect("../Customers/CustomsAviso.aspx")
|
||||
Else
|
||||
MsgBox("Error2")
|
||||
Response.Redirect("login_FLEX.aspx")
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user