Introduction
By default in an ASP.NET Web site, visitors can browse the site anonymously,
load pages, and download the content we provide. They do not have to provide any
credentials for example, by logging in to the site. For most Web sites, of
course, this is just what we want. However, there are occasions, depending on
the type of content we provide, when we want to force users to identify
themselves before they access the content. This might be as soon as they arrive
at the site, or it might be at some point such as a checkout, when they are
buying goods, or just so that we can allocate forum posts this visitor makes to
them like c-sharpcorner.com web portal.
Configuration Files
Most of the default configuration settings for ASP.NET web sites we create are
in the web.config and machine.config files stored in the folder C\Windows\Microsoft.NET\Framework\v[version]\CONFIG\
of your PC. We can override most of these settings simply by placing a
web.config file in the folders of your site or application. Visual Studio 2005
and Visual Web Developer can automatically create these files to enable
debugging of pages as we build your site.
The <system.web> section of the web.config file can contain a section named
<authorization> that controls access to the site and to individual subfolders
with the site's virtual root. If there is no <authorization> in the local or
default web.config file, the equivalent section in the configuration file for
the machine, machine.config, provides the settings.
<system.web>
...
<authorization>
<allow users="*" />
</authorization>
....
</system.web>
ASP.NET Authentication and Authorization
Once ASP.NET starts to process the request received from IIS, it does so using
its own configuration and security settings. These are wholly contained in the
machine.config file and more specifically the various web.config files in the
root and subfolders of your Web site and application directories.
These are the settings the ASP.NET Web Administration Tool is specifically
designed to manage.
ASP.NET Authentication Settings
The <authentication> element can appear in a web.config file in the root of your
Web site or a virtual application root folder. It specifies the type of
authentication ASP.NET uses, the specific settings for this authentication
process and, optionally, the accounts that have access to ASP.NET resources.
<system.web>
...
<authentication mode="Windows|Forms|Passport|None">
<forms name="name"
path="/"
domain="domain name"
loginUrl="url"
defaultUrl="url"
protection="All|None|Encryption|Validation"
timeout="30"
slidingExpiration="true|false"
requireSSL="true|false"
cookieless="UseCookie|UseUri|UseDeviceProfile|AutoDetect"
enableCrossAppRedirects="[true|false]">
<credentials passwordFormat="Clear|SHA1|MD5">
<user name="username" password="password"/>
</credentials>
</forms>
<passport redirectUrl="internal"/>
</authentication>
...
</system.web>
The mode attribute specifies the type of authentication process. The three types
are:
- Windows. In this mode, ASP.NET authenticates users against the list of Windows accounts and groups specified for the machine or the domain within which the machine resides. When using this type of authentication, we do not include the <forms> or <passport> elements within your <authentication> element. Windows authentication is ideal for intranet usage, where users can authenticate in IIS using their Windows logon credentials.
- Forms. In this mode, ASP.NET stores a cookie on the user's machine that
contains encoded authentication information. If this cookie is not present, for
example, when they first visit the site, ASP.NET redirects them to a login page
where they provide their username and password. The <forms> element, described
in more detail in the next section, specifies the parameters and, optionally,
the login credentials applied. When using this type of authentication, we do not
include the <passport> element within your <authentication> element.
- Passport. In this mode, ASP.NET redirects users to the Microsoft Passport Web site where they enter their login credentials for authentication. The Passport site then redirects them to your site after placing a suitable cookie on their machine that identifies them. The <passport> element defines the URL for the Passport site, and we must sign up with Microsoft Passport (and pay a fee) to use this service. When using this type of authentication, we do not include the <forms> element within your <authentication> element.

K P Singh ChundawatPosted Nov 4, 2014, 6:29 AM
Beautiful Article @Abhimanyu K Vatsa Sir....Really Helpful for me Specially about Passport authentication ..Thanks for it Sir ...