Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2019
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <authentication mode="Forms">
  2. <forms name=".ASPXAUTH" loginUrl="login.aspx" protection="All" timeout="999999">
  3. <credentials passwordFormat="MD5">
  4. <user name="admin" password="passwordhashhere" />
  5. </credentials>
  6. </forms>
  7. </authentication>
  8. <authorization>
  9. <allow users="?" />
  10. </authorization>
  11.  
  12. <location path="Admin">
  13. <system.web>
  14. <authorization>
  15. <allow users="admin" />
  16. <deny users="*" />
  17. </authorization>
  18. </system.web>
  19. </location>
  20.  
  21. <div class="user">
  22. <p>Username:</p>
  23. <br />
  24. <asp:TextBox ID="TextBoxUser" runat="server"></asp:TextBox>
  25. </div>
  26.  
  27. <div class="pass">
  28. <p>Password:</p>
  29. <br />
  30. <asp:TextBox ID="TextBoxPass" runat="server" TextMode="Password"></asp:TextBox>
  31. </div>
  32.  
  33. <div class="login">
  34. <asp:Button ID="ButtonLogin" runat="server" Text="Log In" />
  35. <asp:Label ID="LabelError" runat="server" Text=""></asp:Label>
  36. </div>
  37.  
  38. Protected Sub ButtonLogin_Click(sender As Object, e As System.EventArgs) Handles ButtonLogin.Click
  39. If Membership.ValidateUser(TextBoxUser.Text, TextBoxPass.Text) Then
  40. If Request.QueryString("ReturnUrl") IsNot Nothing Then
  41. FormsAuthentication.RedirectFromLoginPage(TextBoxUser.Text, False)
  42. Else
  43. FormsAuthentication.SetAuthCookie(TextBoxUser.Text, False)
  44. End If
  45. Else
  46. LabelError.Text = "Invalid UserID and Password"
  47. End If
  48. End Sub
  49.  
  50. <deny users="?" />
  51.  
  52. <allow users="*" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement