Loginf funktioniert jetzt wieder!
This commit is contained in:
@@ -33,7 +33,9 @@
|
|||||||
void Session_Start(object sender, EventArgs e)
|
void Session_Start(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Code, der ausgeführt wird, wenn eine neue Sitzung gestartet wird
|
// 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)
|
void Session_End(object sender, EventArgs e)
|
||||||
@@ -48,7 +50,5 @@
|
|||||||
Session.Remove("UserID");
|
Session.Remove("UserID");
|
||||||
Session.Remove("test");
|
Session.Remove("test");
|
||||||
Session.Remove("PW");
|
Session.Remove("PW");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
10
Web.config
10
Web.config
@@ -123,5 +123,15 @@
|
|||||||
<add key="ClientValidationEnabled" value="true"/>
|
<add key="ClientValidationEnabled" value="true"/>
|
||||||
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
|
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
|
<location path="Customers">
|
||||||
|
<system.web>
|
||||||
|
<authorization>
|
||||||
|
<allow users="?"/>
|
||||||
|
<!--A question mark (?) denies anonymous users-->
|
||||||
|
</authorization>
|
||||||
|
</system.web>
|
||||||
|
</location>
|
||||||
</configuration>
|
</configuration>
|
||||||
<!--ProjectGuid: 9b651bc0-361a-4f93-8118-dd8a986f2371-->
|
<!--ProjectGuid: 9b651bc0-361a-4f93-8118-dd8a986f2371-->
|
||||||
|
<!--Deny access for 'images' folder-->
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ Partial Class login_FLEX
|
|||||||
Inherits System.Web.UI.Page
|
Inherits System.Web.UI.Page
|
||||||
Protected Sub Page_Load(sender As Object, e As EventArgs)
|
Protected Sub Page_Load(sender As Object, e As EventArgs)
|
||||||
If Me.Page.User.Identity.IsAuthenticated Then
|
If Me.Page.User.Identity.IsAuthenticated Then
|
||||||
Response.Redirect("../Customers/Welcome.aspx")
|
Response.Redirect("../Customers/Welcome.aspx", False)
|
||||||
End If
|
End If
|
||||||
If Not Me.Page.User.Identity.IsAuthenticated Then
|
If Not Me.Page.User.Identity.IsAuthenticated Then
|
||||||
FormsAuthentication.RedirectToLoginPage()
|
FormsAuthentication.RedirectToLoginPage()
|
||||||
|
Response.End()
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub ValidateUser(sender As Object, e As EventArgs)
|
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 regexuserID_M As RegularExpressionValidator = Login2.FindControl("valid_getNumber_M_Input")
|
||||||
Dim regexusername As RegularExpressionValidator = Login1.FindControl("check_UserName_regex")
|
Dim regexusername As RegularExpressionValidator = Login1.FindControl("check_UserName_regex")
|
||||||
Dim regexusername_M As RegularExpressionValidator = Login2.FindControl("check_UserName_M_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 Customer_ID As String = String.Empty
|
||||||
Dim UserNaMe As String = String.Empty
|
Dim UserNaMe As String = String.Empty
|
||||||
@@ -81,7 +84,7 @@ Partial Class login_FLEX
|
|||||||
If regexusername.IsValid Then
|
If regexusername.IsValid Then
|
||||||
UserNaMe = tb2.Text
|
UserNaMe = tb2.Text
|
||||||
Else
|
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
|
End If
|
||||||
Else
|
Else
|
||||||
reqfieldvaluserName.ErrorMessage = "Username has to be given."
|
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."
|
regexusername.ErrorMessage = "Password has to match the criterias of tge info button."
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
If String.IsNullOrEmpty(tb3_M.Text) = False AndAlso String.IsNullOrEmpty(tb3.Text) = True Then
|
End If
|
||||||
|
If String.IsNullOrEmpty(tb3.Text) = False AndAlso String.IsNullOrEmpty(tb3_M.Text) = True Then
|
||||||
reqfieldvalpassw.Enabled = True
|
reqfieldvalpassw.Enabled = True
|
||||||
reqfieldvalpassw_M.Enabled = False
|
reqfieldvalpassw_M.Enabled = False
|
||||||
|
|
||||||
reqfieldvalpassw.Validate()
|
reqfieldvalpassw.Validate()
|
||||||
If reqfieldvalpassw.IsValid = True Then
|
If reqfieldvalpassw.IsValid = True Then
|
||||||
End If
|
|
||||||
passw = tb3.Text
|
passw = tb3.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
|
|
||||||
End If
|
End If
|
||||||
passw = tb3_M.Text
|
If String.IsNullOrEmpty(tb3_M.Text) = False AndAlso String.IsNullOrEmpty(tb3.Text) = True Then
|
||||||
End If
|
|
||||||
End If
|
|
||||||
If String.IsNullOrEmpty(tb3.Text) = False AndAlso String.IsNullOrEmpty(tb3_M.Text) = True Then
|
|
||||||
reqfieldvalpassw.Enabled = False
|
reqfieldvalpassw.Enabled = False
|
||||||
reqfieldvalpassw_M.Enabled = True
|
reqfieldvalpassw_M.Enabled = True
|
||||||
|
|
||||||
reqfieldvalpassw_M.Validate()
|
reqfieldvalpassw_M.Validate()
|
||||||
If reqfieldvalpassw_M.IsValid = True Then
|
If reqfieldvalpassw_M.IsValid = True Then
|
||||||
passw = tb3_M.Text
|
passw = tb3_M.Text
|
||||||
|
Else
|
||||||
|
reqfieldvalpassw_M.ErrorMessage = "Please insert your personal passowrd."
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
' Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
|
' Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
|
||||||
@@ -169,7 +165,7 @@ Partial Class login_FLEX
|
|||||||
Session.Add("test", UserNaMe)
|
Session.Add("test", UserNaMe)
|
||||||
Session.Add("UserID", Customer_ID)
|
Session.Add("UserID", Customer_ID)
|
||||||
Session.Add("PW", passw)
|
Session.Add("PW", passw)
|
||||||
FormsAuthentication.RedirectFromLoginPage(UserNaMe, True)
|
|
||||||
|
|
||||||
'FormsAuthentication.SetAuthCookie(Login1.UserName, True)
|
'FormsAuthentication.SetAuthCookie(Login1.UserName, True)
|
||||||
'Response.Redirect("../Customers/CustomsAviso.aspx")
|
'Response.Redirect("../Customers/CustomsAviso.aspx")
|
||||||
@@ -180,41 +176,18 @@ Partial Class login_FLEX
|
|||||||
con.Close()
|
con.Close()
|
||||||
End Using
|
End Using
|
||||||
End Using
|
End Using
|
||||||
MsgBox("Wow1" + Environment.NewLine + Customer_ID + Environment.NewLine + UserNaMe + Environment.NewLine + passw)
|
If String.IsNullOrEmpty(tb2_M.Text) = False AndAlso String.IsNullOrEmpty(tb2.Text) = True Then
|
||||||
Page.Response.Redirect("../Customers/CustomsAviso.aspx")
|
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
|
End Sub
|
||||||
|
|
||||||
Protected Sub LoginButton_Click(sender As Object, e As EventArgs)
|
Protected Sub LoginButton_Click(sender As Object, e As EventArgs)
|
||||||
Validate("Login")
|
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
|
End Sub
|
||||||
Protected Sub LoginButton_M_Click(sender As Object, e As EventArgs)
|
Protected Sub LoginButton_M_Click(sender As Object, e As EventArgs)
|
||||||
Validate("Login_M")
|
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 Sub
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user