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
我是这样做的:
var path = string.Format("{0}\\{1}", Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile), "AppData")
我是这样做的:
string apPath = Path.Combine(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath, "App_Data");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.