Opening a folder from a web application using c # giving denied access

I used the following code to open a folder from a server on my screen through an ASP.Net MVC 5.0 web application hosted on IIS 7.5 on the same server, the server is using windows 8.

public void OpenFolder()
{
    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo() {
        FileName = "\\SERVERNAME\Public\Lists",
        UseShellExecute = true,
        Verb = "open"
    }); 
}

      

This opens the folder ok when I run my app in development, taking into account that there is an error access denied access.

I have granted all IUSR and IIS_IUSRS permissions to a folder along with Administrators, Users, Network, Network Service and a few other users. But still no luck.

If anyone has encountered the same problem before or knows how to fix the problem, then please throw some light and point me on the path. Also, I am not very good at networking.

+3


source to share


2 answers


In development (using something like IIS Express) the process of running your code runs as your account.

But after deployment, it will run as any account, IIS application pool is configured as.



Please note that IUSR etc. are local accounts; this will be treated as a guest when connected to network resources (such as a share). To do this, you need to run the application pool as a domain account (or a local account on both machines with the same username and password).

+4


source


Try assigning the Application Pool ID (IIS AppPool \ DefaultAppPool - replace DefaultAppPool with your application pool name if different) in the folder. See this link. http://devonenote.com/2010/09/grant-permission-to-defaultapppool-identity/



+1


source







All Articles