[英]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.