Environment.GetFolderPath (Environment.SpecialFolder.InternetCache) returns an empty string in an ASP.Net project

I am developing an ASP.Net project (framework 2.0) on a local computer (Windows 7). IIS 7.5 is a local web server.

When the project starts locally, Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) returns an empty string.

I am a little shy and disappointed since I ran into this problem when I set up this new machine, but I can’t remember the solution and can’t find the Googling solution. Others in the XP development team do not face this problem.

I expect a return of C:\Users\DefaultAppPool\AppData\Local\Microsoft\Windows\Temporary Internet Files .

Not sure if this is a problem with configuring iis or I can set the environment variable somewhere.

Thanks Jeff

+4
source share
1 answer

I am 99% sure that this will lead to a permission issue. In IIS7, there is a new β€œuser” called AppPoolIdentity, which is the default identifier for the application pool. This user has far fewer permissions than the default values ​​in IIS 6.

I can reproduce your problem, I have to configure my AppPool to run as LocalSystem or a specific user with administrator privileges to get Environment.SpecialFolder.InternetCache, which makes sense when I look at the folder in question and look at its permissions.

Remember that there are security issues when starting IIS application pools with higher resolutions.

+5
source

All Articles