繁体   English   中英

用户单击网站链接时自动填写用户名+密码

[英]Auto fill-in username + password when user clicks a website link

我目前正在建立一个Intranet网站,在这个网站上,我们有一些人们经常使用的网站。

但是,有几个网站需要人们登录。 所以我想知道是否有一种方法可以在用户单击链接时自动在该网站上填写用户名和密码框。 登录信息永远不会改变,所有用户都必须使用相同的登录名。 使该过程自动化的操作会使用户更轻松。

因此,在我的aspx中,我会有类似的内容(不是这个确切的网站,而是一个不同的网站):

<a href="https://go.litmos.com/account/Login" target="_blank">Litmos</a><br />

我不确定是否需要使用后面的代码来做我想做的事情,或者可能需要一些Javascript。

我要寻找的功能类型类似于KeePass中提供的功能。 在其中输入用户名和密码以及网站URL的地方,当您从KeePass打开该网站时,它将为您填充登录信息。 我意识到那是一个桌面应用程序,我正在构建一个ASP.NET网站。 我想知道像这样的事情是否可能,如果可以,怎么做。

就是这样,您正在使用C#作为Intranet网站的后台代码。

我想出了怎么做。 制作一个新的HTML页面,并将下面的代码添加到其中。 完成后,您可以在任何需要的地方创建链接,并使源等于您刚创建的HTML页面。

<html>
    <head>
        <title>Automatic Login</title>
    </head>
    <body onload="document.forms['securelog'].submit();">
        <form action="[enter the login url here]" method="post" name="securelog">
            <input type="hidden" name="userid*" value="[enter-your-username-here]">
            <input type="hidden" name="password*" value="[enter-your-password-here]">

            <!--You can get the name of the username and password fields by looking at the source code of your website's URL. some websites might have 'username' and 'password' as the names for the username and password fields.-->

        </form>
    </body>
</html>

我不确定这是否是最好的方法,但是可以。

或者,如果您担心奇怪的用户看到此页面的源代码,则可以使用php进行类似的操作,以便您的用户名和密码仅出现在php代码中,并且由于php将在服务器上执行,因此该源代码我认为代码不会显示用户名和密码。 我没有尝试过该解决方案,因为我没有在该Web服务器上安装php,也没有计划安装它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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