Security and the File System


Many of the code samples in this chapter write or access files in a directory. Before you can access files in a directory from within an ASP.NET page, you need to check whether the necessary permissions have been granted for the directory.

By default, the ASP.NET process executes in the security context of the ASPNET user account. If this account does not have permissions to write a file to a directory, then you'll receive an access exception when you attempt to write a file. To avoid an access exception, you'll need to grant write permissions to either the ASPNET user account or the Users group (By default, the Users group includes the ASPNET user account).

To grant the necessary permissions for writing to a directory to either the ASPNET user account or Users group, follow these steps:

  • Right-click the directory

  • Select Properties

  • Select the tab labeled Security

  • Add either the Users group or the ASPNET user account to the directory

  • Make sure that either the Users group or the ASPNET user account has Write permissions enabled

  • Click OK

For more information on the ASPNET user account see Chapter 20, "Using Windows-Based Authentication."



ASP.NET Unleashed
ASP.NET 4 Unleashed
ISBN: 0672331128
EAN: 2147483647
Year: 2003
Pages: 263

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net