简体   繁体   English

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

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

I am currently building an intranet site and on this site, we have websites people would frequently use. 我目前正在建立一个Intranet网站,在这个网站上,我们有一些人们经常使用的网站。

There are a couple of websites where people need to login though. 但是,有几个网站需要人们登录。 So I was wondering if there is a way to automatically fill in the username and password box on that website when the user clicks the link for it. 所以我想知道是否有一种方法可以在用户单击链接时自动在该网站上填写用户名和密码框。 The login info will never change and all users have to use the same login. 登录信息永远不会改变,所有用户都必须使用相同的登录名。 Something that automates this process would make things easier for the user. 使该过程自动化的操作会使用户更轻松。

So in my aspx, I would have something like this (not this exact website but a different one): 因此,在我的aspx中,我会有类似的内容(不是这个确切的网站,而是一个不同的网站):

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

I'm not sure if I need to use the code behind to do what I want or maybe some Javascript. 我不确定是否需要使用后面的代码来做我想做的事情,或者可能需要一些Javascript。

The type of functionality I am looking for is like the one found in KeePass. 我要寻找的功能类型类似于KeePass中提供的功能。 Where you enter your username and password along with a website url and when you open that website from KeePass, it fills the login info for you. 在其中输入用户名和密码以及网站URL的地方,当您从KeePass打开该网站时,它将为您填充登录信息。 I realize that that is a desktop application and I'm building an ASP.NET website. 我意识到那是一个桌面应用程序,我正在构建一个ASP.NET网站。 I want to know if something like this is possible and if so, how. 我想知道像这样的事情是否可能,如果可以,怎么做。

Just so you know, I'm using C# for the code behind for the intranet site. 就是这样,您正在使用C#作为Intranet网站的后台代码。

I figured out how to do this. 我想出了怎么做。 Make a new HTML page and add the code below to it. 制作一个新的HTML页面,并将下面的代码添加到其中。 When done, you can create a link wherever you wanted and make the source equal to the HTML page you just created. 完成后,您可以在任何需要的地方创建链接,并使源等于您刚创建的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>

I'm not sure if this is the best way to do this but it works. 我不确定这是否是最好的方法,但是可以。

Alternatively, if you are worried about an odd user seeing the source code for this page, you could use php to do something similar so that your username and password only appear in your php code and since php would be executed on the server, the source code wouldn't show the username and password, I think. 或者,如果您担心奇怪的用户看到此页面的源代码,则可以使用php进行类似的操作,以便您的用户名和密码仅出现在php代码中,并且由于php将在服务器上执行,因此该源代码我认为代码不会显示用户名和密码。 I haven't tried that solution because I don't have php installed on this webserver, nor do I plan to install it. 我没有尝试过该解决方案,因为我没有在该Web服务器上安装php,也没有计划安装它。

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

相关问题 由于用户不存在/密码/用户名正确而导致尝试登录网站失败时如何返回消息? - How to return a message when a try to login to the website failed, because the user does not exist/password/username arent correct? 用户点击恶意链接时易受攻击 - Vulnerable when user clicks on a malicious link 网站登录自动填充 - Website log in auto fill 如何使用DotNetBrowser填写用户名和密码 - How to fill in username and password using DotNetBrowser 使用用户名和密码将用户连接到数据库 - Connecting user to database with username and password 如何在c#中验证网站的密码和用户名 - How to validate Password and Username for website in c# 将用户输入的用户名/密码与mysql数据库的用户名/密码进行比较 - Comparing user input username/password to mysql database username/password not working 当用户单击外部来源的链接时,如何在应用程序中打开特定页面? - How can I open a specific page in my app when the user clicks a link from an outside source? 当用户单击Ctrl键+链接按钮时,如何在新标签页中打开页面? - How to open a page in new tab when user clicks ctrl key + link button? 当多个ID标签为同一C#时,自动填充网站中的文本框 - Auto fill textbox in a website when multiple Id tags are the same c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM