i have login window and id password is save on browser.
i want to clear password when page load and restrict to login with save credential.
textmode=password.
Please give resolution if you have in vb.net.
Loading
i have login window and id password is save on browser.
i want to clear password when page load and restrict to login with save credential.
textmode=password.
Please give resolution if you have in vb.net.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
rupesh gourRank #6,510 · 264 reputationPosted Mar 4, 2024, 2:26 AM EST
this is not working..
rupesh gourRank #6,510 · 264 reputationPosted Mar 4, 2024, 2:29 AM EST
password text box is not clearing.
Actually password is saved on browser .
i also use javascript
rupesh gourRank #6,510 · 264 reputationPosted Mar 4, 2024, 2:37 AM EST
already added still not work
rupesh gourRank #6,510 · 264 reputationPosted Mar 4, 2024, 2:43 AM EST
JS is also try to clear textbox value nothing else
rupesh gourRank #6,510 · 264 reputationPosted Mar 4, 2024, 2:48 AM EST
its working.
but i select again username password is get filled because save on browser.
Amit MohantyRank #112 · 20K reputationPosted Mar 4, 2024, 2:49 AM EST
Set the AutoCompleteType attribute of the password textbox to Disabled, instructing the browser not to autocomplete the password field. Add the below script to Page_load
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then ' Register JavaScript to clear password field on page load Dim clearPasswordScript As String = "document.getElementById('" & txtPassword.ClientID & "').value = '';" ClientScript.RegisterStartupScript(Me.GetType(), "ClearPasswordField", clearPasswordScript) End If End SubJithu ThomasRank #437 · 5.7K reputationPosted Mar 4, 2024, 2:24 AM EST
Imports System Public Class Login Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then ' Clear the password field when the page loads txtPassword.Text = String.Empty End If End Sub Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnLogin.Click ' Your login logic here End Sub End ClassKindly follow this code in the backend will resolve your issue.
Jithu ThomasRank #437 · 5.7K reputationPosted Mar 4, 2024, 2:33 AM EST
include this snippet in the front end code.
check this as the addition of
autocomplete="new-password"to the passwordTextBox, thisattribute helps prevent browsers from automatically filling in the password field.Jithu ThomasRank #437 · 5.7K reputationPosted Mar 4, 2024, 2:41 AM EST
i dont understand what is the need of this javascript function. please share the logic of the javascript.
the same is working for me.
Jithu ThomasRank #437 · 5.7K reputationPosted Mar 4, 2024, 2:48 AM EST
If Not IsPostBack Then ' Clear the password field when the page loads txtPassword.Text = String.Empty End IfVB.net code will clear the text box. why JS. please refer the snippet which i send before.
Tuhin PaulRank #7 · 71.9K reputationPosted Mar 10, 2024, 1:30 PM EDT
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load ' Call JavaScript function to clear password field ClientScript.RegisterStartupScript(Me.GetType(), "ClearPassword", "ClearPasswordField();", True) End SubIn VB.NET, you can achieve this by utilizing JavaScript to clear the password field when the page loads and preventing the browser from autofilling the saved credentials. Add a JavaScript function to clear the password field
function ClearPasswordField() { // Clear password field document.getElementById('').value = ''; }Add the JavaScript function to your ASPX page or include it in a separate JavaScript file