0
votes

I Have an asp.net web application that access files on shared folder from remote host, when the web application is run from vs2008 it retrives the image files and display them.how ever when i deploy the same project in IIS using virtual directory, the application couldn't access the files on the shared folder it says access denied.

is there any persmission setting i needed to add, I have already add the Asp.net and network service to the project files on the phsical path where the virtual path is pointing too.

    string pic3 = @"\\M37350\temp\GraphicUserImage.jpg";


        FileInfo f = new FileInfo(pic3);


        if (f.Exists)
        {

            Image1.ImageUrl = pic3;
            Image1.Visible = true;
        }

Thanks.

3

3 Answers

3
votes

VS2008 is using your credentials when executing web application. You will need to set up an account (one that has access to the remote folder) in your IIS virtual directory.

1
votes

you'll need to set the Application Pool's Identity to a domain account (domain\user) with access to this shared folder, the built-in "Network Service" account doesn't have access to a remote shared folder.

To change your App Pool Identity:

you'll need to know which Application Pool your website is using by going to the Website properties "Home Directory" tab (Application Pool is the last item)

Website Properties - Home Directory tab (IIS6)

Close out the Website properties and under Application Pools in IIS find the corresponding Application Pool, open properties and go to the "Identity" tab to change the user.

Application Pool Properties - Identity tab (IIS6)

Might also check this answer on serverfault.com: Permission for ASP.NET application on web server to access shared folder on another server

And this step by step for setting custom app pool identity ASP.Net and IIS Support Team Blog for Microsoft France

0
votes

You need to chmod the shared folder so it is readable and writable to you and/or others. Usually the host has an interface for this. As far as I know, the permissions cannot be set from code.