ASP.NET Security Tutorials

How does File Authorization work in ASP.NET

ASP.NET uses type of authorization which is file-based authorization, and it’s implemented by the FileAuthorizationModule. This authorization takes effect only if you’re using Windows authentication.   If you’re using custom authentication or forms authentication, it’s not used.

You can understand file authorization if you know how he Windows operating system enforces file system security. When your …

Learn more

How to control access for specific roles in ASP.NET

If you need to manage an enterprise application that supports thousands of users and you need to define permissions for each individual user, it would be exhausting, difficult to change, and nearly impossible to complete without error. The easiest way to maintain the users is to group them into categories called roles.

In Windows authentication …

Learn more

How to control access to specific files in ASP.NET

You can use approach described in the article How to control access to specific directories in ASP.NET to set file access permissions by directory. You also have the option of restricting specific files by adding <location> tags to your web.config file. The <location> tags sit outside the main <system.web> tag and are nested directly in the …

Learn more

How to control access to specific directories in ASP.NET

A usual application design is to place files that require authentication into a separate folder.  You can follow this approach in ASP.NET by leaving the <authorization> element in the normal parent directory empty and adding a web.config file that specifies stricter settings in the secured directory.

When you add the web.config file in the subdirectory …

Learn more

How to control access for specific users in ASP.NET

You can manage set of users, anonymous or authenticated, by using approach described in the article How to define authorization rules in ASP.NET. You can use the <allow> and <deny> rules to specify a user name or a list of comma-separated user names.  The next example shows how to use <deny> rule to restrict access for …

Learn more

How to define authorization rules in ASP.NET

You can define the authorization rules in the <authorization> element within the <system.web> section of  the web.config file. The basic structure is as follows:

 

<authorization>

<allow users=”comma-separated list of users”

roles=”comma-separated list of roles”

verbs=”comma-separated list of verbs” />

<deny users=”comma-separated list of users”

roles=”comma-separated list of roles”

verbs=”comma-separated list of verbs” />

</authorization>

 

There …

Learn more

How does URL Authorization work in ASP.NET

ASP.NET supports resource-specific authorization without requiring you to change code and recompile the application with declarative authorization rules, which you can define in the web.config file. These rules defined by you are acted by a specific HTTP module named UrlAuthorizationModule. This module examines these rules and checks each request to make sure users can’t access resources …

Learn more

How to perform the Impersonation as a step of Programmatic Impersonation in VB.NET

Configured impersonation, described in the article How to use Configured Impersonation in ASP.NET, allows you to impersonate a user for the entire duration of a request. By using programmatic impersonation (based on the WindowsIdentity.Impersonate() method) , you have more control, such  as the ability to impersonate a user for only part of the page request. This …

Learn more

How to perform the Impersonation as a step of Programmatic Impersonation in C#

Configured impersonation, described in the article How to use Configured Impersonation in ASP.NET, allows you to impersonate a user for the entire duration of a request. By using programmatic impersonation (based on the WindowsIdentity.Impersonate() method) , you have more control, such  as the ability to impersonate a user for only part of the page request. This …

Learn more

How to get a token as a step of Programmatic Impersonation in VB.NET

Configured impersonation, described in the article How to use Configured Impersonation in ASP.NET, allows you to impersonate a user for the entire duration of a request. By using programmatic impersonation (based on the WindowsIdentity.Impersonate() method) , you have more control, such  as the ability to impersonate a user for only part of the page request. This …

Learn more