简体   繁体   English

asp.net使用ssl无需登录页面即可进行身份验证

[英]asp.net forms authentication without login page using ssl

I wish to use forms authentication in an asp.net website, but without a specific login page. 我希望在asp.net网站中使用表单身份验证,但没有特定的登录页面。 Instead, I'd like to let my users login via a DIV section on the upper right corner of the screen. 相反,我想让我的用户通过屏幕右上角的DIV部分登录。 Moreover, I would like that this DIV section will use SSL. 此外,我希望该DIV部分将使用SSL。

My suggestion to the implemention is: 1. creating a login.aspx page that contains only the div element with a Form tag. 我对实现的建议是:1.创建一个login.aspx页面,该页面仅包含带有Form标签的div元素。 2. on every page in the site (possibly even in one master page), create an IFrame that contains the login.aspx page. 2.在站点的每一页上(甚至可能在一个母版页上),创建一个包含login.aspx页的IFrame。 3. if the user performs a login - display "Hi username" in the login.aspx page. 3.如果用户执行登录-在login.aspx页中显示“ Hi username”。 Otherwise, display a login credentials textbox. 否则,显示登录凭据文本框。

This suggestion uses a specific login.aspx page, but it is disguised by the IFrame and the Master page. 此建议使用特定的login.aspx页,但IFrame和“母版”页掩盖了该建议。 I think this suggestion is creative and I can't think of a reason why it wouldn't work. 我认为这个建议很有创意,我想不出它为什么行不通的原因。 Before I'll try it, is this the way to go? 在我尝试之前,这是要走的路吗? Can someone suggest another solution? 有人可以建议其他解决方案吗?

Thanks in advance. 提前致谢。

This is a complex solution to a problem that doesn't exist. 这是解决不存在的问题的复杂解决方案。

All you need to do is use the Login server control, and edit the template to fit whatever you want. 您需要做的就是使用登录服务器控件,然后编辑模板以适合您的需要。 Place this in the Master Page, and hook it up. 将此放置在母版页上,并将其连接起来。 For added benefit, you can write some code to detect if the user is logged in, and if so hide the login control and display the users name. 为了获得更多好处,您可以编写一些代码来检测用户是否已登录,如果隐藏,则隐藏登录控件并显示用户名。

Alternatively, you could put the login control in a user control that would encapsulate this functionality. 或者,您可以将登录控件放在可以封装此功能的用户控件中。

Another alternative is to write your own Login control that does this (it's not difficult). 另一种选择是编写自己的Login控件来做到这一点(这并不困难)。

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

相关问题 在ASP.NET MVC5中使用自定义登录进行表单身份验证 - Using Custom Login for forms authentication in asp.net mvc5 ASP.Net在没有表单身份验证的情况下保护我的页面 - ASP.Net Protecting My Page without Forms Authentication 没有登录页面的ASP.NET自定义身份验证 - ASP.NET Custom authentication without login page ASP.NET 4.5 C# 表单身份验证访问被拒绝登录页面 - ASP.NET 4.5 C# Forms Authentication access denied to login page ASP.NET表单身份验证-登录页面上的JavaScript错误(匿名用户访问时) - ASP.NET Forms Authentication - JavaScript errors on Login page (when anonymous users visit) 尽管成功登录,ASP.NET表单身份验证始终为false - ASP.NET Forms Authentication always false despite successful login 如何在ASP.NET表单身份验证中启用多次登录尝试? - How to enable multiple login tries in asp.net forms authentication? 使用ASP.NET Forms身份验证,如何让图像显示在登录屏幕上? - Using ASP.NET Forms Authentication, how do I get an image to appear on the login screen? ASP.NET登录表单身份验证没有登录控件 - ASP.NET login form authentication without login control 使用会话变量(没有表单/窗口)身份验证登录每个ASP页面? - Login check in each ASP page using session variables (without forms/windows) authentication?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM