Я бы хотел запретить браузеру chrome автоматически заполнять текстовое поле с именем пользователя на странице учетной записи login.aspx, которую я создал.
Я попытался установить для свойства AutoCompleteMode в Textbox значение «Нет» или «Отключено», но все равно ничего.
Мой код переднего конца для входа в систему:
<asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false" onloggedin="LoginUser_LoggedIn">
<LayoutTemplate>
<span class="failureNotification">
<asp:Literal ID="FailureText" runat="server"></asp:Literal>
</span>
<asp:ValidationSummary ID="LoginUserValidationSummary" runat="server" CssClass="failureNotification"
ValidationGroup="LoginUserValidationGroup"/>
<div class="accountInfo">
<fieldset class="login">
<legend><asp:Literal ID="Literal3" runat="server" Text="<%$ Resources:chienvh.language, AccountInformation%>" /></legend>
<p>
<%--<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Username:</asp:Label>--%>
<asp:TextBox ID="UserName" runat="server" CssClass="textEntry" AutoPostBack="true" Placeholder="<%$ Resources:chienvh.language, Username%>" OnTextChanged="UserName_TextChanged"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" CssClass="failureNotification"
ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
</p>
<p>
<%--<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>--%>
<asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password" Placeholder="<%$ Resources:chienvh.language, Password%>"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required."
ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:DropDownList runat="server" ID="DDLSite" DataSourceID="DSSite" DataValueField="SiteID" DataTextField="Site"></asp:DropDownList>
<asp:SqlDataSource runat="server" ID="DSSite" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
SelectCommand="Select 'Επίλέξτε Site...' [Site], 0 SiteID
union
Select [Site], [SiteID]
from Site
order by [Site]"></asp:SqlDataSource>
</p>
<p>
<asp:CheckBox ID="RememberMe" runat="server"/>
<asp:Label ID="RememberMeLabel" runat="server" AssociatedControlID="RememberMe" CssClass="inline">Keep me logged in</asp:Label>
</p>
</fieldset>
<p class="submitButton">
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="LoginUserValidationGroup"/>
</p>
</div>
</LayoutTemplate>
</asp:Login>
И задняя часть:
protected void LoginUser_LoggedIn(object sender, EventArgs e)
{
string error = "";
string User_Name = LoginUser.UserName.ToString();
if (Common.Is_Inactive_User(User_Name, ref error) || error != "")
FormsAuthentication.SignOut();
Roles.DeleteCookie();
Session.Clear();
}