Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get DefaultAppPool AppData folder from the web application

I have a web application which is running from DefaultAppPool account. I want to write some files into the DefaultAppPool's AppData folder (or any other folder, which is 100% accessible from the account my application is running)

I've tried

Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData)

but for some reason, it returns an empty string.

Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile)

returns C:\\Users\DefaultAppPool as expected.

How can I get the AppData path for DefaultAppPool?

EDIT: This code is executed in the Model

like image 485
VladL Avatar asked Dec 17 '13 14:12

VladL


1 Answers

I do it like this:

var path = string.Format("{0}\\{1}", Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile), "AppData")
like image 96
hutchonoid Avatar answered Oct 11 '22 14:10

hutchonoid