简体   繁体   中英

ASP.NET logon and registration with browser password memory

I have followed the asp.net pages for registration and login. Everything works, except that the username/password combo is never remember by the browser (ie. browser autocomplete). This is an issue with all browsers. The key fields seem to be named appropriately, I think:

    <LayoutTemplate>
            <div class="formlayout">
                <p>
                    Enter your login details</p>
                <asp:ValidationSummary runat="server" DisplayMode="BulletList" CssClass="errors" />
                <div class="b">
                    <asp:RegularExpressionValidator runat="server" Display="Dynamic" ErrorMessage="Invalid email address."
                        ValidationExpression="^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$"
                        ControlToValidate="UserName" SetFocusOnError="false" >*</asp:RegularExpressionValidator>
                    <asp:RequiredFieldValidator runat="server" Display="Dynamic" ErrorMessage="Enter your email address."
                        ControlToValidate="UserName" SetFocusOnError="false" >*</asp:RequiredFieldValidator>
                    Email address<div class="s">
                        Your login identity</div>
                </div>
                <div class="tb">
                    **<asp:TextBox runat="server" ID="UserName" />**</div>
                <div class="b">
                    <asp:RequiredFieldValidator runat="server" Display="Dynamic"
                        ErrorMessage="Enter your password." ControlToValidate="UserName" SetFocusOnError="false" >*</asp:RequiredFieldValidator>
                    Password<div class="s">
                        Your registered password</div>
                </div>
                <div class="tb">
                    **<asp:TextBox runat="server" ID="Password" Name="Password" ClientIDMode="Static" TextMode="Password" />**</div>
                <div class="shift">
                    <asp:CheckBox runat="server" ID="RememberMe" Text="Keep me logged in" />
                </div>
                <div class="shift">
                    <asp:Button ID="BtnLogin" ClientIDMode="Static" runat="server" CommandName="Login" Text="Login" />
                </div>
            </div>
        </LayoutTemplate>

To clarify: My browser is set to remember passwords. Here's a thought... I am testing off 'localhost' -- are browsers set not to remember usernames and passwords that are running off localhost?

Your server-side code does not have anything to do with whether or not the browser's Auto-Complete works. That's a setting in the browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM