I wish to use forms authentication in an asp.net website, but without a specific login page.
Instead, I’d like to let my users login via a DIV section on the upper right corner of the screen. Moreover, I would like that this DIV section will use SSL.
My suggestion to the implemention is:
1. creating a login.aspx page that contains only the div element with a Form tag.
2. on every page in the site (possibly even in one master page), create an IFrame that contains the login.aspx page.
3. if the user performs a login – display “Hi username” in the login.aspx page. 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. 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).