I was looking for the the trick to resolve that error (google, stackoverflow.com etc) and every nothing works. I need to dynamically create an .aspx file via the asp.net application.
What I've done to try fix it:
1) In the folder's Properties -> Security, I've added IUSR_TONY and also IIS_IUSRS and allow them the Full control to the folder. Just to check if开发者_开发技巧 that will help. Nope, it won't.
2) in the IIS Manager, I tried to change the Application's Pool Defaults Identity (based on that) I checked all options, with no success
I don't know what to do more to fix it. Any ideas ?
Directions for IIS 6
You need to change the 'Home Directory' permissions with IIS Manager.
Open Properties on the website. Select the 'Home Directory' tab. Check the 'Write' checkbox to enable write permissions.
If you are set on doing this, I would suggest only enabling write on a particular directory and not the entire website. Changing the permissions for a single directory is the same as above except instead of selecting Properties for the entire website, choose Properties for the directory where you will be creating files.
Directions for IIS 7
- Open Internet Information Systems (IIS) Manager
- Expand the site you want to modify (hit the plus next to the name)
- Right-click the directory where you would like to be able to write files and select
Edit Permissions
- Click on the
Security
tab - Click on
Edit...
under the group and users list - Select
IIS_IUSRS
from the "Groups or user names" list and add make sure theAllow
checkbox is marked forWrite
.
I know this sounds a lot like what you did in 1) of your question but I'm guessing you may just edited the permissions through Windows Explorer rather than IIS Manager. Let me know what error(s) you see if the steps above still don't work for you.
I tested writing a file to disk using an example from aspalliance.com and it worked great when I granted IIS_IUSRS
write permission to the output directory and stopped working when I removed the write permission.
Please state your operating system and version of IIS.
You need to grant access to the account that is running the app-pool in IIS. It is usually NT Authority\Network Service, so try granting full control to that account.
However, if you are using windows integrated security (and have impersonation=true) on your website, the user that must be granted access, is the user requesting the page.
Finally, I really want to discourage you from making a blog system that creates aspx files on the fly. It's simply not the way to do it.
精彩评论