Friday, April 29, 2011

ASP.NET Login page

I want to add login for registered users in my website. How shall I proceed with it? Is it through the use of sessions? What will happen to the Session variable once the logout happens??

From stackoverflow
  • You should use the provided Login control and Membership system.

    About Session vars, nothing special will happen. ASP.NET forms authentication does not use SessionState by default.

    Roshan : I dont want to use the Login Control.
    Mehrdad Afshari : Then you can use the underlying membership APIs: http://msdn.microsoft.com/en-us/library/yh26yfzy(loband).aspx
  • I'd take a look a related questions, such as

    http://stackoverflow.com/questions/592364/login-membership-net

    This topic is already covered quite a lot on SO.

    Session state and log in are somewhat orthogonal. You have a session regardless of whether or not you are logged in.

  • I would recommend using forms authentication with perhaps a custom backend using IIdentity and IPrincipal. There’s lots of information available how to do this but I think this link forms a good starting point http://msdn.microsoft.com/en-us/library/aa480476.aspx

  • Your question is extremely broad and there are many different ways that you can implement what is, in effect, a "membership" system for an ASP.NET website.

    I would suggest that you start by reading the "Introduction to Membership" article from MSDN. This article will give you an overview of how ASP.NET membership works in the most "standard" way.

    It also mentions using the various ASP.NET membership "controls" (Login, LoginView, LoginStatus & PasswordRecovery for example).

    Using these controls along with the built-in ASP.NET membership providers (for example, ASP.NET provides a SQL membership provider to work against SQL Server as the data store for your user accounts and credentials) will allow you to implement a complete membership and authentication system with virtually no code at all (i.e. all the functionality is provided by the built-in "membership" controls and declarative mark-up).

    Finally, a really good series of articles on this subject is:

    Examining ASP.NET 2.0's Membership, Roles, and Profile

    from the 4guysfromrolla site. It's starts at the very beginning of the membership topic and goes right the way through to touching on the implementation of a custom membership provider and administrative interface for managing user credentials to round out the whole subject.

0 comments:

Post a Comment