470,594 Members | 1,491 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

GetEnvironmentVariable and IIS 6.0

I had an ASPNET application keeping files into the LocalApplicationData
folder of the ASPNET account in IIS 5.0 which worked perfectly, but it
doesn't workon IIS 6.0 (windows server 2003). I rely on the function
Environment.GetFolderPath to get this path, and for the Network Service
account, this function returns an empty string, though a directory named
C:\Documents and Settings\NetworkService exists.

I then tried to use Environment.GetEnvironmentVariable to get the
USERPROFILE environment variable, and it returns C:\Documents and
Settings\LocalService (and NOT C:\Documents and Settings\NetworkService as
would be expected since the it is the network service account that runs
w3wp.exe !!!). Of course, the Network Service account cannot write in this
directory, since it's not its profile directory.

I don't understand why Network Service doesn't return correct special
folders, and I don't understand why its USERPROFILE environment variable is
set to the one of Local Service. If anybody has a clue...

NB : all these functions return correctly on a Windows Server 2003 UPGRADED
from Windows Server 2000... Welcome to the twilight zone !!!

Regards

François
Nov 19 '05 #1
0 1209

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Stephen Costanzo | last post: by
6 posts views Thread by Nikolay Petrov | last post: by
3 posts views Thread by Drwtsn32 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.