Suggestion for Login Page Html

Topics: Controls
May 14, 2010 at 3:03 PM

Only a suggestion: While customizing BlogEngine, I noticed that the login.aspx is using asp:login which renders HTML 4.0 tables; if layouttemplate were used then the page could render more preferred HTML:

	<asp:login id="Login1" runat="server" class="loginbox">
			<div id="login_container">
							<label for='<asp:literal runat="server" id="username_label_for" />' id="username_label">User Name</label>
							<asp:textbox id="username" runat="server" />
                            <asp:requiredfieldvalidator id="usernamerequired" runat="server" controltovalidate="username" text="*"></asp:requiredfieldvalidator></li>
							<label for='<asp:literal runat="server" id="password_label_for" />' id="password_label">Password</label>
							<asp:textbox id="password" runat="server" textmode="password" />
                            <asp:requiredfieldvalidator id="passwordrequired" runat="server" controltovalidate="password" text="*"></asp:requiredfieldvalidator></li>
						<li><asp:button id="login" commandname="login" runat="server" text="login" /></li>

And the login.aspx.cs could be written to:

Login1.LoggingIn += Login1_LoggingIn;
Login1.LoggedIn += Login1_LoggedIn;

TextBox __login = Login1.FindControl("username")as TextBox;
if(null == __login) { return; }
TextBox __password = Login1.FindControl("password") as TextBox;
if(null == __password) { return; }


Literal __literal1 = Login1.FindControl("username_label_for") as Literal;
if(null != __literal1) { __literal1.Text = __login.ClientID; }
Literal __literal2 = Login1.FindControl("password_label_for") as Literal;
if(null != __literal2) { __literal2.Text = __password.ClientID; }

- Nicholas

May 14, 2010 at 3:19 PM

Good point, thanks for suggestion.