title: How to disable login and password autocomplete by browser on creating and editing user pages?
body: <p>Browsers remember login and password and offer to fill inputs automatically when creating and editing user. I want it to be enabled only on login page. Setting <code>autocomplete</code> to <code>off</code> for whole form and every input doesn't help. I changed password input's type to <code>text</code> and modified it to <code>password</code> using JavaScript after page loads, but it also doesn't help. It seems that it doesn't matter what are values of <code>name</code> and <code>id</code> attributes - it always offers filling login and password for every <code>&lt;input type="password" /&gt;</code> element with one <code>&lt;input type="text" /&gt;</code> element preceding it.</p>
  
  <p>This is fragment of my code in Razor view for creating new user (below is also plain HTML):</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      @Html.LabelFor(model =&gt; model.Email, new { @class = "control-label col-sm-3" })
      &lt;div class="col-sm-8"&gt;
          @Html.TextBoxFor(model =&gt; model.Email, new { @class = "form-control" })
          @Html.ValidationMessageFor(model =&gt; model.Email, "", new { @class = "text-danger" })
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="form-group"&gt;
      @Html.LabelFor(model =&gt; model.Password, new { @class = "control-label col-sm-3" })
      &lt;div class="col-sm-8"&gt;
          @Html.PasswordFor(model =&gt; model.Password, new { @class = "form-control" })
          @Html.ValidationMessageFor(model =&gt; model.Password, "", new { @class = "text-danger" })
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="form-group"&gt;
      @Html.LabelFor(model =&gt; model.ConfirmPassword, new { @class = "control-label col-sm-3" })
      &lt;div class="col-sm-8"&gt;
          @Html.PasswordFor(model =&gt; model.ConfirmPassword, new { @class = "form-control" })
          @Html.ValidationMessageFor(model =&gt; model.ConfirmPassword, "", new { @class = "text-danger" })
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The same code with ASP.NET MVC helpers converted to HTML:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label class="control-label col-sm-3" for="Email"&gt;Email address&lt;/label&gt;
      &lt;div class="col-sm-8"&gt;
          &lt;input class="form-control" data-val="true" data-val-email="The Email address field is not a valid e-mail address." data-val-required="The Email address field is required." id="Email" name="Email" type="text" value="" /&gt;
          &lt;span class="field-validation-valid text-danger" data-valmsg-for="Email" data-valmsg-replace="true"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;label class="control-label col-sm-3" for="Password"&gt;Password&lt;/label&gt;
      &lt;div class="col-sm-8"&gt;
          &lt;input class="form-control" data-val="true" data-val-length="The Password must be at least 6 characters long." data-val-length-max="100" data-val-length-min="6" data-val-required="The Password field is required." id="Password" name="Password" type="password" /&gt;
          &lt;span class="field-validation-valid text-danger" data-valmsg-for="Password" data-valmsg-replace="true"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;label class="control-label col-sm-3" for="ConfirmPassword"&gt;Confirm password&lt;/label&gt;
      &lt;div class="col-sm-8"&gt;
          &lt;input class="form-control" data-val="true" data-val-equalto="The password and confirmation password do not match." data-val-equalto-other="*.Password" data-val-required="The Confirm password field is required." id="ConfirmPassword" name="ConfirmPassword" type="password" /&gt;
          &lt;span class="field-validation-valid text-danger" data-valmsg-for="ConfirmPassword" data-valmsg-replace="true"&gt;&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>