Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net Internet Explorer将错误输入保存为密码_Asp.net_Internet Explorer_Passwords_Forms - Fatal编程技术网

Asp.net Internet Explorer将错误输入保存为密码

Asp.net Internet Explorer将错误输入保存为密码,asp.net,internet-explorer,passwords,forms,Asp.net,Internet Explorer,Passwords,Forms,我试图创建一个登录表单,向服务器提交一个加密密码,同时在表单外部的隐藏字段上设置明文 在Chrome/Firefox中,它记住隐藏字段中设置的登录名/密码,而在IE中,它记住加密密码 我想知道我怎样才能解决这个问题 以下是我所拥有的: <script> function encryptPassword() { var txtUsername= document.getElementById("txtUsername"); var txtPass

我试图创建一个登录表单,向服务器提交一个加密密码,同时在表单外部的隐藏字段上设置明文

在Chrome/Firefox中,它记住隐藏字段中设置的登录名/密码,而在IE中,它记住加密密码

我想知道我怎样才能解决这个问题

以下是我所拥有的:

<script>
    function encryptPassword() {
        var txtUsername= document.getElementById("txtUsername");
        var txtPassword= document.getElementById("txtPassword");

        document.getElementById('username').value = txtUsername.value;
        document.getElementById('password').value = txtPassword.value;

        txtPassword.value = encrypt(md5(txtPassword.value), "<%=pubKey %>");
    }
</script>

<div style="visibility: hidden">
    <input type="text" name="username" id="username" style="width:0;height:0" tabindex="-1" />
    <input type="password" name="password" id="password" style="width:0;height:0" tabindex="-1" />
</div>

<form id="form1" runat="server">
    <asp:TextBox ID="txtUsername" autofocus="autofocus" required="required"  runat="server" />
    <asp:TextBox ID="txtPassword" TextMode="Password" required="required" runat="server" />
    <asp:Button ID="btnLogin" OnClick="btnOk_Click" OnClientClick="encryptPassword();" runat="server" />
</form>

函数encryptPassword(){
var txtUsername=document.getElementById(“txtUsername”);
var txtPassword=document.getElementById(“txtPassword”);
document.getElementById('username')。value=txtUsername.value;
document.getElementById('password').value=txtPassword.value;
txtPassword.value=加密(md5(txtPassword.value),“”);
}

在将加密密码发布到服务器之前,您将其存储在
txtPassword
中,这就是
存储密码的原因。您可以将加密密码存储在隐藏字段中,并在身份验证期间从该字段中检索密码

更换这条线

txtPassword.value = encrypt(md5(txtPassword.value), "<%=pubKey %>");
txtPassword.value=encrypt(md5(txtPassword.value),“”);
某物

hfPassword.value = encrypt(md5(txtPassword.value), "<%=pubKey %>");
hfPassword.value=encrypt(md5(txtPassword.value),“”);
其中
hfPassword
将是隐藏字段,您必须将其添加到表单中


我将被保存为加密文本。不要保存TXT密码值。改为保存密码。txtPassword将仅用于用户交互和加密功能的输入。

请单击
代码段编辑器按钮,而不是粘贴ASP,只将HTML和JS粘贴到“对不起”中,但代码段编辑器似乎无法识别ASP,因为这是理解我的问题所必需的。您的问题看起来只是表单/HTML/JavaScript,但是密码也将以明文形式提交到服务器,我不打算购买https证书。否。我将被保存为加密文本。不要保存TXT密码值。改为保存密码。txtPassword将仅用于用户交互和加密功能的输入。但是,如果提交表单时txtPassword位于表单内部,则也将提交该表单。但我已经在研究一个解决方案,包括在提交之前设置
disabled='disabled'
,并在出现任何错误时取消设置