I have an 'access denied' problem on an ASP.NET web application, where the user uploads an Excel file and I try and write it to a folder. I don't have access to the host except FTP, so I can't set permissions. I thought that ASP.NET would be able to write to a folder that is under the web app root, but it isn't so.
Is there anywhere I can write the file to that doesn't require me to set permissions?
ASP.NET can write to a folder if the account under which it is running (the application pool user) has write permissions on it.
If this is indeed a temporary file, you can get a filename from the Path
class using GetTempFileName()
:
string tempPath = Path.GetTempFileName();
You can use this in conjunction with IsolatedStorage to be sure you have permissions to write to a folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With