app data - Getting Access denied trying to read a file in App_Data in a ASP.NET project - Any pointers? -
I have an XMD file that is stored in App_Data which is used only to read some configurations on startup When I try to open it within my code, I get access to the path ... the message has been denied.
Why I am having trouble understanding, and how to solve it, I think in theory that I should change the permissions on the file (and directory), but nothing has changed it.
To give a bit more background: 1. One of its projects is bundled with the project, so setup made by VS2008 wrote it in the right place during installation. I did not think I would need to install an unusual post, such as the ASP.NET application would be used. 2. When I tried to publish it locally, I had no problem. - It's only on a test Windows 2003 server. I have run a simple page to understand the effective user of IIS - this is NT AUTHORITY \ NETWORK service. I tried to give this user "full access" to this file , And even then it does not work
The code is simple to open it:
FileStream fs = new filestream (server.mappath, filemod.open);
Whereas S ~ ~ / App_Data / myfile.xml is defined as
I have also copied and pasted the full path & amp; File name (with exception) and tried to "dir" on it, and it actually exists (for example, around a typo).
Actually, I think I got it. I need to open the file as follows:
New file stream (Server.mappath (files), File MOD. Open, FileAccess. Read);
Comments
Post a Comment