GetEnvironmentVariable and IIS 6.0

Discussion in 'ASP .Net' started by Guest, Aug 16, 2005.

  1. Guest

    Guest Guest

    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
     
    Guest, Aug 16, 2005
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.