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.

188<br />

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

SQL session state can be configured either in Machine.config or Web.config.<br />

The default setting in machine.config is shown below.<br />

<br />

By default, the SQL script InstallSqlState.sql, which is used for building the database<br />

used for SQL session state is installed at the following location:<br />

C:\WINNT\Microsoft.<strong>NET</strong>\Framework\v1.0.3705<br />

When you use SQL session state there are two problems to consider.<br />

● You must secure the database connection string.<br />

● You must secure the session state as it crosses the network.<br />

Securing the Database Connection String<br />

If you use SQL authentication to connect to the server, the user ID and password<br />

information is stored in plain text in web.config as shown below.<br />

<br />

By default the HttpForbiddenHandler protects configuration files from being<br />

downloaded. However, any user who has direct access to the folders where the<br />

configuration files are stored can still see the user name and password. A better<br />

practice is to use Windows authentication to SQL Server.<br />

<br />

To use Windows authentication, you can use the <strong>ASP</strong>.<strong>NET</strong> process identity (typically<br />

<strong>ASP</strong><strong>NET</strong>)<br />

1. Create a duplicate account (with the same name and password) on the database<br />

server.<br />

2. Create a SQL login for the account.<br />

3. Create a database user in the <strong>ASP</strong>State database and map the SQL login to the<br />

new user.<br />

The <strong>ASP</strong>State database is created by the InstallSQLState.sql script.

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

Saved successfully!

Ooh no, something went wrong!