ASP.NET  •  Hold User Credentials

Listing 1. The Login.aspx file contains the standard username and password textboxes for holding the user credentials. The VB code-behind for the Login button does all the processing, and you use a label to signal to the user that an invalid set of credentials was given.

<%@ Register TagPrefix="mobile" 
   Namespace="System.Web.UI.MobileControls"
   Assembly="System.Web.Mobile, 
      Version=1.0.3300.0, Culture=neutral, 
   PublicKeyToken=b03f5f7f11d50a3a" %>
<%@ Page Language="vb" AutoEventWireup="false" 
   Inherits="Mobile.Login"
   codebehind="Login.aspx.vb" 
      EnableViewState="false"%>
<meta name="GENERATOR" content=
   "Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content=
   "Visual Basic 7.0">
<meta name="vs_targetSchema"
   content=
      "http://schemas.microsoft.com/Mobile/Page">
<body Xmlns:mobile="http://schemas.microsoft.com/
   Mobile/WebForm">
   <mobile:Form id="frmLogin" runat="server" 
      title="MyApp" Method="Get">
      <mobile:Label id="Label1" runat="server" 
         Text="User ID: " 
         BreakAfter="False" Wrapping="NoWrap">
            </mobile:Label>
      <mobile:TextBox id="txtUserID" 
         runat="server" 
         Wrapping="NoWrap">Guest</mobile:TextBox>
      <mobile:Label id="Label2" runat="server" 
         Text="Password: " 
         BreakAfter="False" 
            Wrapping="NoWrap"></mobile:Label>
      <mobile:TextBox id="txtPassword" 
         runat="server" BreakAfter="False" 
         Wrapping="NoWrap" Password="True">
            </mobile:TextBox>
      <mobile:Command id="btnLogin" 
         runat="server">Login</mobile:Command>
      <mobile:Label id="lblInvalidLogin" 
         runat="server" 
         ForeColor="Red">*-Invalid Credentials
            </mobile:Label>
   </mobile:Form>
</body>