Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 20th, 2010 | Syntax: None | Size: 2.22 KB | Hits: 41 | Expires: Never
Copy text to clipboard
  1. login.aspx
  2. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  3.  
  4. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="PresenceLogin.login" %>
  5.  
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7.  
  8. <html xmlns="http://www.w3.org/1999/xhtml" >
  9. <head runat="server">
  10.     <title>Presence</title>
  11. </head>
  12. <body>
  13.     <form id="form1" runat="server">
  14.     <div>
  15.     <h1>Presence</h1>
  16.     <font face="Arial" ptsize="3">Please log in.</font>
  17.     <br /><br />
  18.     <h2>User:</h2>
  19.     <asp:TextBox ID="username" runat="server"/>
  20.     <h2>Password:</h2>
  21.     <asp:TextBox ID="password" runat="server" TextMode="Password"/>
  22.     <br />
  23.     <asp:Button ID="submit" runat="server" OnClick="checkCreds" Text="Submit" />
  24.     </div>
  25.     </form>
  26. </body>
  27. </html>
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35. login.aspx.cs
  36. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  37.  
  38. using System;
  39. using System.Collections.Generic;
  40. using System.Linq;
  41. using System.Web;
  42. using System.Web.UI;
  43. using System.Web.UI.WebControls;
  44.  
  45. namespace PresenceLogin
  46. {
  47.  
  48.     public partial class login : System.Web.UI.Page
  49.     {
  50.         protected Dictionary<String, String> userList = new Dictionary<String, String>();
  51.         protected String inputHash;
  52.         protected void Page_Load(object sender, EventArgs e)
  53.         {
  54.             userList.Add("jarred", "FDCCA2432652E9CD534A27E5D8A532A8");
  55.             userList.Add("ghassan", "21b09aa6c3ad1ad22d7e50dc7836dcfe");
  56.             userList.Add("kevin", "8a06b507f0b8233f8b0c993880c8fe16");
  57.         }
  58.         protected void checkCreds(Object o, EventArgs e)
  59.         {
  60.             inputHash = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(username.Text + password.Text,"MD5");
  61.             if (!userList.ContainsKey(username.Text)) { Response.Write("User not found."); }
  62.             else {
  63.                 if (userList[username.Text] == inputHash) { Response.Redirect("passaccepted.htm"); }
  64.                 else { Response.Write("Invalid password"); }
  65.             }
  66.         }
  67.     }
  68. }