tags:

views:

167

answers:

2

Hi, I was looking for the the trick to resolve that error (google, stackoverflow.com etc) and every nothing works. I need to dinamically 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 ?

A: 

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.

klausbyskov
"It's simply not the way to do it." Why not ? Or maybe store the whole article's text in the database ?
Tony
@Tony, there are so many reasons it's a bad idea that I have started a question to sum up the main points: http://stackoverflow.com/questions/2419028/top-3-reasons-not-to-develop-a-blog-system-that-generates-aspx-files-on-the-fly
klausbyskov
A: 

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

  1. Open Internet Information Systems (IIS) Manager
  2. Expand the site you want to modify (hit the plus next to the name)
  3. Right-click the directory where you would like to be able to write files and select Edit Permissions
  4. Click on the Security tab
  5. Click on Edit... under the group and users list
  6. Select IIS_IUSRS from the "Groups or user names" list and add make sure the Allow checkbox is marked for Write.

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.

lostriebo
in IIS7 there is no site Properties option. Or maybe I just don't see it
Tony
@Tony, sorry about that. I should have stated that I was working from IIS 6. It looks like the 'Home Directory' tab is now in the 'Features' view pane under 'Authorization Rules.' I'll update later tonight with more specific instructions after I get a chance to play with IIS 7.
lostriebo
It turns out 'Authorization Rules' isn't what was needed in this particular instance. I based my comment on a webpage that claimed to map configuration screens in IIS 6 to IIS 7. Apparently, it was wrong or I misunderstood the table.
lostriebo