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.

xvi<br />

Contents<br />

How To:<br />

Create an Encryption Library 429<br />

Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429<br />

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429<br />

1. Create a C# Class Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430<br />

2. Create a Console Test Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437<br />

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438<br />

How To:<br />

Store an Encrypted Connection String in the Registry 439<br />

Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439<br />

Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439<br />

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440<br />

1. Store the Encrypted Data in the Registry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440<br />

2. Create an <strong>ASP</strong>.<strong>NET</strong> Web Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443<br />

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444<br />

How To:<br />

Use Role-based Security with Enterprise Services 445<br />

Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445<br />

Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445<br />

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446<br />

1. Create a C# Class Library Application to Host the Serviced Component . . . . . . . . . 446<br />

2. Create the Serviced Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446<br />

3. Configure the Serviced Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447<br />

4. Generate a Strong Name for the Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448<br />

5. Build the Assembly and Add it to the Global Assembly Cache . . . . . . . . . . . . . . . . 449<br />

6. Manually Register the Serviced Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449<br />

7. Examine the Configured Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449<br />

8. Create a Test Client Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450<br />

How To:<br />

Call a Web Service Using Client Certificates from <strong>ASP</strong>.<strong>NET</strong> 453<br />

Why Use a Serviced Component? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453<br />

Why is a User Profile Required? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454<br />

Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455<br />

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455<br />

1. Create a Simple Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455<br />

2. Configure the Web Service Virtual <strong>Directory</strong> to Require Client Certificates . . . . . . . 456<br />

3. Create a Custom Account for Running the Serviced Component . . . . . . . . . . . . . . 457<br />

4. Request a Client Certificate for the Custom Account . . . . . . . . . . . . . . . . . . . . . . 457<br />

5. Test the Client Certificate Using a Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459

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

Saved successfully!

Ooh no, something went wrong!