Forms vs Windows authentication


Actually, last day I spent some time over it and after some experimenting with my website, I’m going to write what I found.
The main thing about Forms authentication is : it is being used for ASP.NET web application. With forms authentication, ASP.NET is expected to handle
all the details of authentication and security.
On the contrary The default authentication mode for ASP.NET applications is Windows, which is fine if you’re working in an intranet environment where every user probably has a Windows login for use in the corporate network anyway. Using Windows authentication, Windows itself handles all the security and authentication, and you can use the myriad of Windows utilities and functions such as Active Directory, to manage your users.
The mechanism is, to use forms authentication and the SqlMembershipProvider, we need to create a database to authenticate against. This database will hold our user information, as well as membership information, so we can both authenticate the user and provide access based on membership in specific roles.
What I’ve done, I created the database using aspnet_regsql.exe and later added it to my website’s App_Data folder. So that later it became easier to add other tables and establish a relationship between them.
In fact going this way, I can reduce the volume of App_Data folder drastically. If one goes using Windows authentication, the App_Data folder takes more than 10 mb space.
Instead if one uses Forms authentication, and in web.config uses membership provider then the whole scene changes quite interstingly.
We use this type of code after Forms authentication

Before it we have to declare connectionstring in web.config like this:

Obviously the connectionstrings will be changed accordingly.
Using this we can take aspnetdb.mdf to App_Data folder and moreover add other tables accordingly.
It is neccessary as there are some hosting companies who do not allow more than one database.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s