Sometimes it is required to change the username under which asp.net runs. Some scenarios would be authenticating to ms sql via windows authentication, listing users under asp.net directory (see ActiveDirectoryMembershipProvider), accessing shares on the network etc. Here's how to do it.
First we create the account (local or domain account) and assign the necessary rights (sql, network share, whatever). Here as always less is better.
Second we run:
aspnet_regiis -ga domain\AccountName
Domain may be replaced by the computer name if the account is local. For those of you who are interestred aspnet_regiss assigns read rights for the IIS metabase and read/write rights for %Windir%\Microsoft.NET\Framework\version\Temporary ASP.NET.
Also note the sometimes the user requires write permission for %Windir%\temp, this might be an configuration error from one of the setups where the temp path is not set to %Windir%\Microsoft.NET\Framework\version\Temporary ASP.NET, but %Windir%\temp.
Third in computer management under iis section (around the services section) under application pools, we create a new application pool (or configure an old one if you prefer) and we set under the Identity tab the new user identity.
Forth We set the application to use the new application pool (properties on the application, the Home Directory tab)
Also note that if you use kerberos authentication you might have problems, to avoid the follow the link in the reference section and there search for "Creating Service Principal Names (SPNs) for Domain Accounts". This is actualy a shorter version of that document so you might want to have a look at it.
Referinte







