28.12.2013 Views

Building Secure ASP.NET Applications - People Search Directory

Building Secure ASP.NET Applications - People Search Directory

Building Secure ASP.NET Applications - People Search Directory

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

152<br />

<strong>Building</strong> <strong>Secure</strong> <strong>ASP</strong>.<strong>NET</strong> <strong>Applications</strong><br />

To configure <strong>ASP</strong>.<strong>NET</strong> impersonation use the following element in<br />

your application’s Web.config.<br />

<br />

3. Configure Authorization. URL authorization determines whether a user or role<br />

can issue specific HTTP verbs (for example, GET, HEAD, and POST) to a specific<br />

file. To implement URL authorization, you perform the following tasks.<br />

a. Add an element to the Web.config file located in your<br />

application’s virtual root directory.<br />

b. Restrict access to users and roles by using allow and deny attributes. The<br />

following example from Web.config uses Windows authentication and allows<br />

Bob and Mary access but denies everyone else.<br />

<br />

<br />

<br />

<br />

Important: You need to add either or at the<br />

end of the element, otherwise access is granted to all authenticated<br />

identities.<br />

URL Authorization Notes<br />

Take note of the following when you configure URL authorization:<br />

● “*” refers to all identities.<br />

●<br />

●<br />

●<br />

“?” refers to unauthenticated identities (that is, the anonymous identity).<br />

You don’t need to impersonate for URL authorization to work.<br />

Authorization settings in Web.config usually refer to all of the files in the current<br />

directory and all subdirectories (unless a subdirectory contains its own<br />

Web.config with an element. In this case the settings in the<br />

subdirectory override the parent directory settings).<br />

Note: URL authorization only applies to file types that are mapped by IIS to the <strong>ASP</strong>.<strong>NET</strong><br />

ISAPI extension, aspnet_isapi.dll.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!