ASP.NET: State Server Gems

Published 01 September 05 01:06 PM | despos

The September 2005 issue of MSDN Magazine contains an excellent article from one of program managers on the Web Platform and Tools Team at Microsoft--Michael Volodarsky. The article examines and suggests best practices to design and deploy high-performance and secure session solutions. If you're doing any serious ASP.NET development (and not just with coming-very-soon 2.0 version) that article is a must-read.

In particular, I'd like to emphasize a passage from the text regarding the ASP.NET state-server--the external process (aspnet_state.exe) that, started as a Windows service, serves as a session state out-of-process data store. In regard to this component, it is important to note that it doesn’t oppose any authentication barrier to requestors. In other words, it means that anyone who can get access to the network (and place calls to the server) is potentially free to access session data for all sessions. To protect session state and make sure that it is only accessed by the Web server machine, you can use a firewall or IPSec policies. Another security related countermeasure consists in changing the default port number (42424 by default). However, simply changing this number in the web.config file (precisely in the TCP connection string) is not enough. In ASP.NET 2.0, as well as in ASP.NET 1.x, you also need to edit a registry key. Locate the following:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters

and write the port number in the REG_DWORD Port entry.

Another handy suggestion from the Michael's article regards remote connections to the state server process. By default, the state server only listens to local loopback interface for connections. If the state server is on another machine than the Web server, you must enable remote connection explicitly. Once again, this requires another registry change. Under the aforementioned key, set the REG_DWORD AllowRemoteConnection entry to a nonzero value.

Comments

# David Taylor said on September 1, 2005 12:53 PM:

Hi Dino,

This is good info...But note that for AllowRemoteConnection ASP.NET will throw an exception with this same information/instruction if you try connecting to a remote machine where this has not been enabled.

The first time I tried to configure a web farm, I received an exception with this info, and did what is prompted me to do (as you detail above). So I never needed to look up MSDN to figure out what to do.

# mattonsoftware.com said on May 27, 2006 06:38 AM:

The following links to .NET resources have been collated over time with the assistance of colleagues. ...

Leave a Comment

(required) 
(required) 
(optional)
(required)