Thursday, June 30, 2011

Uploading Files to Network File Share from ASP.net

There are a few steps you have to take if you are storing images on a network share instead of the local drive and your site is using Windows Authentication.

Web Config

    <authentication mode="Windows" />
    <identity impersonate="true" userName="domain\user" password="password" />
    <authorization>
      <deny users="?" />
    </authorization>

Image/File Share

Add modify permissions on physical path where images will be stored for the domain user specified in the web.config.

Site Folder

Add modify permissions on folder where site is published, i.e.: C:\inetpub\wwwroot\site folder for the domain user.

Temporary ASP.Folder

Add modify permissions on {SYSTEM}\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files for the domain user.