⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.aspx

📁 ASP.NET Web Forms Techniques
💻 ASPX
📖 第 1 页 / 共 2 页
字号:
  catch (Exception e) {
    return false;
  }
  finally {
    sqlConn.Close();
  }
}

// -------------------------------------------------------

void UpdateUserIDCookie() {
// write new cookie with UserID to client's browser

  HttpCookie oCookie = new HttpCookie("WccUserID", sUserID);
  oCookie.Path = "/";
  DateTime dNow = DateTime.Now;
  oCookie.Expires = dNow.AddYears(5);
  Response.Cookies.Add(oCookie);
}

// --------------------------------------------------
</script>


<!doctype html public "-//IETF//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Login to Xrox Car Company</title>
<basefont size="2" face="Tahoma,Arial,Helvetica,sans-serif">
<link rel="stylesheet" type="text/css" href="../stylesheets/wcc<% = sStyleSize %>.css" />
<title>Login to Xrox Car Company</title>

<script language="JavaScript">
<!--
function setUserIDFocus() {
  var txtUserID = document.forms[0].elements['txtLogonUserID'];
  txtUserID.focus();
  txtUserID.select();
}
function disableSubmit(sAction) {
  var btnLogin = document.forms[0].elements['btnLogon'];
  var btnRegister = document.forms[0].elements['btnRegister'];
  if (btnRegister == null) return;
  if (sAction == 'Logon') {
    btnRegister.disabled = false;
    btnLogin.disabled = true;
  }
  else {
    btnLogin.disabled = false;
    btnRegister.disabled = true;
  }
}
//-->
</script>

</head>
<body bgcolor="#ffffff" class="body-text" onload="setUserIDFocus()"><div style="position:absolute;height:0px;"><font size="1" color=#ffffff">

<!-- skip link for aural page readers -->
<layer visibility="hidden">
<a href="#content" style="color:#ffffff;font-size:1px;text-decoration:none"><img width="1" height="1" hspace="0" vspace="0" src="../images/_blnk.gif" border="0" alt="Skip to Content" /></a>
</layer>
</font></div>

<form runat="server">

<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tbody>
 <tr>
  <td valign="top" width="110px">
    <a Title="Back to List of Models" href="../home.aspx">
     <img src="../images/btn_home.gif" width="100" height="49" hspace="3" vspace="2" alt="Home Page" border="0" /></a>
  </td>
  <td align="left">
    <a name="content" />
    <font face="Arial,Helvetica,sans-serif" size="4" color="#b50055">
    <p class="large-red-text"><b>Login to Xrox Car Company "My Cars" Page</b></p></font>

    <!-- login for existing user -->
    <font face="Tahoma,Arial,Helvetica,sans-serif" size="2"><span class="body-text">
    if (you have previously registered with us, please enter your<br />
    User ID and the matching password.) { click <b>Log in</b>:</span>
    <table cellpadding="5" cellspacing="5" border="0">
    <tr>
      <td colspan="2" align="center" nowrap="nowrap">
      <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
        <span class="body-text">User ID:</span>
        <asp:TextBox id="txtLogonUserID" CssClass="body-text"
             TabIndex="1" Columns="15" runat="server"
             ToolTip="Enter your registered user ID"
             onkeypress="disableSubmit('Register')"
             onfocus="javascript:window.status='Enter your registered user ID...'" />
        <asp:RequiredFieldValidator id="valRequLogonUserID" runat="server"
             ControlToValidate="txtLogonUserID" Display="dynamic"
             ErrorMessage="You must provide your User ID">*
        </asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator id="valRegexLogonUserID" runat="server"
             ControlToValidate="txtLogonUserID" Display="dynamic"
             ValidationExpression="\S{4,20}"
             ErrorMessage="Your User ID must be between 4 and 20 characters with no spaces">*
        </asp:RegularExpressionValidator> &nbsp; &nbsp;
        &nbsp; &nbsp; <span class="body-text">Password:</span>
        <asp:TextBox id="txtLogonPWord" CssClass="body-text"
             TabIndex="2" TextMode="Password" Columns="10" runat="server"
             ToolTip="Enter the password you provided when you registered"
             onkeypress="disableSubmit('Register')"
             onfocus="javascript:window.status='Enter the password you provided when you registered...'" />
        <asp:RequiredFieldValidator id="valRequLogonPWord" runat="server"
             ControlToValidate="txtLogonPWord" Display="dynamic"
             ErrorMessage="You must provide your password">*
        </asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator id="valRegexLogonPWord" runat="server"
             ControlToValidate="txtLogonPWord" Display="dynamic"
             ValidationExpression="\S{4,20}"
             ErrorMessage="Your password must be between 4 and 20 characters with no spaces">*
        </asp:RegularExpressionValidator></font></td>
    </tr><tr>
      <td align="left" nowrap="nowrap">
        <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
        <span id="spnHideChecbox" runat="server">
        <asp:CheckBox id="chkPersist" CssClass="body-text" TabIndex="3" runat="server" />
        Log in automatically next time<br />(until you click <b>Log Off</b>
        in the My Cars page)</span></font></td>
      <td align="right" valign="bottom"><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
        <asp:Button id="btnLogon" Text="Log in" CssClass="body-text" runat="server"
             ToolTip="Log in to view the My Cars page"
             TabIndex="4" OnClick="DoLogin" /></font></td>
    </tr><tr>
      <td colspan="2" align="center" nowrap="nowrap">
        <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
        <b><asp:Label id="lblLoginMsg" CssClass="body-text"
                EnableViewState="false" runat="server" /></b></font></td>

    </tr>
    </table>

    <!-- summary of validation errors -->
    <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
    <asp:ValidationSummary id="valSummary" runat="server"
         HeaderText="<hr /><b>Sorry, your values cannot be accepted.</b><br />
                     The following errors were found. Please check<br />
                     the values you entered (marked with '*')</b>" /></font>

    <asp:panel id="pnlRegister" visible="False" runat="server">
      <!-- register for new user -->
      <hr size="1" /><p />
      <font face="Tahoma,Arial,Helvetica,sans-serif" size="2"><span class="body-text">
      if (you <b>have not</b> previously registered with us, you can do so now.<br />
      Please complete the form below, indicating the User ID and password<br />
      you want to use to access this site in future.) { click <b>Register</b>:</span>
      <table cellpadding="5" cellspacing="5" border="0">
      <tr>
        <td colspan="4" align="left" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span class="body-text">User ID (minimum 4 characters, no spaces):</span>
          <asp:TextBox id="txtUserID" CssClass="body-text"
               TabIndex="5" Columns="15" runat="server"
               ToolTip="Enter a User ID (4 to 20 characters, no spaces)"
               onkeypress="disableSubmit('Logon')"
               onfocus="javascript:window.status='Enter the User ID you want to use to log on in the future...'" />
          <asp:RequiredFieldValidator id="valRequUserID" runat="server"
               ControlToValidate="txtUserID" Display="dynamic"
               ErrorMessage="You must provide a User ID">*
          </asp:RequiredFieldValidator>
          <asp:RegularExpressionValidator id="valRegexUserID" runat="server"
               ControlToValidate="txtUserID" Display="dynamic"
               ValidationExpression="\S{4,20}"
               ErrorMessage="Your User ID must be between 4 and 20 characters with no spaces">*
          </asp:RegularExpressionValidator></font></td>
      </tr><tr>
        <td colspan="4" align="left" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span class="body-text">Password (minimum 6 characters):</span>
          <asp:TextBox id="txtPWord" CssClass="body-text"
               TabIndex="6" TextMode="Password" Columns="10" runat="server"
               ToolTip="Enter a password (6 to 20 characters, no spaces)"
               onkeypress="disableSubmit('Logon')"
               onfocus="javascript:window.status='Enter a password to use to log on in the future...'" /> &nbsp; &nbsp;
          <asp:RequiredFieldValidator id="valRequPWord" runat="server"
               ControlToValidate="txtPWord" Display="dynamic"
               ErrorMessage="You must provide a password">*
          </asp:RequiredFieldValidator>
          <asp:RegularExpressionValidator id="valRegexPWord" runat="server"
               ControlToValidate="txtPWord" Display="dynamic"
               ValidationExpression="\S{6,20}"
               ErrorMessage="Your password must be between 6 and 20 characters with no spaces">*
          </asp:RegularExpressionValidator>
          <span class="body-text">Confirm Password:</span>
          <asp:TextBox id="txtPWordCheck" CssClass="body-text"
               TabIndex="7" TextMode="Password" Columns="10" runat="server"
               ToolTip="Type the password again to confirm"
               onkeypress="disableSubmit('Logon')"
               onfocus="javascript:window.status='Retype the password to check that it is correct...'" />
          <asp:RequiredFieldValidator id="valRequPWordCheck" runat="server"
               ControlToValidate="txtPWordCheck" Display="dynamic"
               ErrorMessage="You must confirm your new password">*
          </asp:RequiredFieldValidator>
          <asp:CompareValidator id="valCompPWordCheck" runat="server"
               ControlToValidate="txtPWordCheck" Display="dynamic"
               ControlToCompare="txtPWord" Type="String"
               ErrorMessage="The password and confirmation that you entered do not match">*
          </asp:CompareValidator></font></td>
      </tr><tr>
        <td align="right" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span class="body-text">Full Name:</span></font></td>
        <td align="left" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <asp:TextBox id="txtName" CssClass="body-text"
               TabIndex="8" Columns="25" runat="server"
               ToolTip="Enter your full name (5 - 50 characters)"
               onkeypress="disableSubmit('Logon')"
               onfocus="javascript:window.status='Enter your full name...'" />
          <asp:RequiredFieldValidator id="valRequName" runat="server"
               ControlToValidate="txtName" Display="dynamic"
               ErrorMessage="You must provide your full name">*
          </asp:RequiredFieldValidator>
          <asp:RegularExpressionValidator id="valRegexName" runat="server"
               ControlToValidate="txtName" Display="dynamic"
               ValidationExpression=".{5,50}"
               ErrorMessage="Your Name must be between 5 and 50 characters">*
          </asp:RegularExpressionValidator></font></td>
        <td align="right" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span class="body-text">&nbsp; &nbsp; Country:</span></font></td>
        <td align="left" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <asp:TextBox id="txtCountry" CssClass="body-text"
               TabIndex="12" Columns="20" runat="server"
               ToolTip="Enter the full name of your country"
               onkeypress="disableSubmit('Logon')"
               onfocus="javascript:window.status='Enter the name of your Country...'" />
          <asp:RequiredFieldValidator id="valRequCountry" runat="server"
               ControlToValidate="txtCountry" Display="dynamic"
               ErrorMessage="You must enter the name of your Country">*
          </asp:RequiredFieldValidator>
          <asp:RegularExpressionValidator id="valRegexCountry" runat="server"
               ControlToValidate="txtCountry" Display="dynamic"
               ValidationExpression=".{2,30}"
               ErrorMessage="The value for Country must be between 2 and 30 characters">*
          </asp:RegularExpressionValidator></font></td>
      </tr><tr>
        <td align="right" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span class="body-text">Address:</span></font></td>
        <td align="left" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <asp:TextBox id="txtAddr" CssClass="body-text"
               TabIndex="9" Columns="25" runat="server"
               ToolTip="Enter your address (6 - 60 characters)"
               onkeypress="disableSubmit('Logon')"
               onfocus="javascript:window.status='Enter your address...'" />
          <asp:RequiredFieldValidator id="valRequAddr" runat="server"
               ControlToValidate="txtAddr" Display="dynamic"
               ErrorMessage="You must enter your full address details">*
          </asp:RequiredFieldValidator>
          <asp:RegularExpressionValidator id="valRegexAddr" runat="server"
               ControlToValidate="txtAddr" Display="dynamic"
               ValidationExpression=".{6,60}"
               ErrorMessage="The value for Address must be between 6 and 60 characters">*
          </asp:RegularExpressionValidator></font></td>
        <td align="right" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span class="body-text">&nbsp; &nbsp; Phone:</span></font></td>
        <td align="left" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <asp:TextBox id="txtPhone" CssClass="body-text"
               TabIndex="13" Columns="20" runat="server"
               ToolTip="Enter your complete phone number (optional)"
               onkeypress="disableSubmit('Logon')"
               onfocus="javascript:window.status='Enter your phone number...'" /></font></td>
      </tr><tr>
        <td align="right" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span class="body-text">City:</span></font></td>
        <td align="left" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <asp:TextBox id="txtCity" CssClass="body-text"
               TabIndex="10" Columns="25" runat="server"
               ToolTip="Enter the full name of your city (2 - 30 characters)"
               onkeypress="disableSubmit('Logon')"
               onfocus="javascript:window.status='Enter the name of your City...'" />
          <asp:RequiredFieldValidator id="valRequCity" runat="server"
               ControlToValidate="txtCity" Display="dynamic"
               ErrorMessage="You must enter your City name">*
          </asp:RequiredFieldValidator>
          <asp:RegularExpressionValidator id="valRegexCity" runat="server"
               ControlToValidate="txtCity" Display="dynamic"
               ValidationExpression=".{2,30}"
               ErrorMessage="The value for City must be between 2 and 30 characters">*
          </asp:RegularExpressionValidator></font></td>
        <td align="right" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span class="body-text">&nbsp; &nbsp; Email:</span></font></td>
        <td align="left" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <asp:TextBox id="txtEmail" CssClass="body-text"
               TabIndex="14" Columns="20" runat="server"
               ToolTip="Enter your complete email address"
               onkeypress="disableSubmit('Logon')"
               onfocus="javascript:window.status='Enter your Email adddress...'" />
          <asp:RequiredFieldValidator id="valRequEmail" runat="server"
               ControlToValidate="txtEmail" Display="dynamic"
               ErrorMessage="You must provide an Email address">*
          </asp:RequiredFieldValidator>
          <asp:RegularExpressionValidator id="valRegexEmail" runat="server"
               ControlToValidate="txtEmail" Display="dynamic"
               ValidationExpression="([a-zA-Z0-9_\-\.]+)@(([a-zA-Z0-9\-]+\.)+)([a-zA-Z0-9]{2,4})"
               ErrorMessage="You must enter a valid email address">*
          </asp:RegularExpressionValidator></font></td>
      </tr><tr>
        <td align="right" valign="top" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span class="body-text">State:</span></font></td>
        <td align="left" valign="top" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <asp:TextBox id="txtState" CssClass="body-text"
               TabIndex="11" Columns="25" runat="server"
               ToolTip="Enter the name of your State or County (2 - 20 characters)"
               onkeypress="disableSubmit('Logon')"
               onfocus="javascript:window.status='Enter the name of your State or County...'" />
          <asp:RequiredFieldValidator id="valRequState" runat="server"
               ControlToValidate="txtState" Display="dynamic"
               ErrorMessage="You must enter your State or County name">*
          </asp:RequiredFieldValidator>
          <asp:RegularExpressionValidator id="valRegexState" runat="server"
               ControlToValidate="txtState" Display="dynamic"
               ValidationExpression=".{2,20}"
               ErrorMessage="The value for State must be between 2 and 20 characters">*
          </asp:RegularExpressionValidator></font></td>
        <td colspan="2" align="right" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <asp:Button id="btnRegister" Text="Register" CssClass="body-text" runat="server"
               ToolTip="Click to register these details and access the My Cars page"
               TabIndex="15" OnClick="DoRegister" />
          </font></td>
      </tr><tr>
        <td colspan="4" align="center" nowrap="nowrap">
          <font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <b><asp:Label id="lblRegisterMsg" CssClass="body-text"
                  EnableViewState="false" runat="server" /></b></font></td>

      </tr>
      </table>
    </asp:panel>

    <hr size="1" />
    <font size="1" face="Arial,Helvetica,sans-serif">
    <a href="../home.aspx" title="Home Page">Home</a> &nbsp; &nbsp;
    <font size="1" face="Arial,Helvetica,sans-serif">&copy;2002 <a href="http://www.daveandal.net/" title="Dave And Al">Dave And Al</a>
    UK and USA. Contact: <a href="mailto:webmaster@your-own-site.com?subject=Xrox Cars Web Site"
    title="Support Email Address">webmaster@your-own-site.com</a></font>

  </td>
 </tr>
</tbody>
</table>

</form>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -