Thursday, September 16, 2010

The identity of an application pool in IIS

When creating a new application pool, it’s often convenient to be able to identify the identity the pool is using. The issue arises usually on IIS 7/7.5 where default application pools use identities of a form IIS APPPOOL\identityname. And when you grant access to databases/file system you have to provide the identity name in an exact form.

Usually I tend to use this simple script. Just copy it into a text file, name it test.aspx and point your browser to it. The application pool’s identity name will be presented to you in a clear way.

<%@ Page Language="C#" %>
 
Current user: <%= System.Security.Principal.WindowsIdentity.GetCurrent().Name %>

No comments: