Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
code is
System.Diagnostics.Process.Start(@"\\web1\");

Error is
Exception Details: System.ComponentModel.Win32Exception: Access is denied

Stack Trace:


[Win32Exception (0x80004005): Access is denied]
System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) +1091
System.Diagnostics.Process.Start(ProcessStartInfo startInfo) +60
_Default.Button1_Click(Object sender, EventArgs e) +22
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981

What I have tried:

Application pool identity set as localservice and then
In IIS ADMIN Service enabled the allow service to interact with desktop
Posted
Updated 13-Jun-21 4:57am

Read the error message:
Access is denied

It means what it says: your user - IIS - does not have the required permissions to access a file or folder.

That doesn't surprise me: in production servers, IIS will only have access to the file it needs to do it's job - which means that your process will as well.

If you meant to run an app on the Client, you can't. It only seemed to work in development because the client and server were the same computer. In prod, they are potentially separated by thousands of Km, and your C# code has no access to the client hardware at all.

If you meant to run an app on the server, you need to ensure that access to the folder it resides in, plus all its data and dependant folders are available and accessible to the IIS user.
 
Share this answer
 
What you're starting will only open an Explorer window to the shares available on a server called web1.

There are several problems with this. First, all ASP.NET code runs entirely on the server, never the client, so your process is trying to start on the server, which nobody will ever see since service accounts, like IIS or ASP.NET, don't have a visible Desktop to show anything on.

Whoever requests your web page will NOT see anything executed by that "Process.Start" statement.

Next, you're getting the error message because the service account your app is running under doesn't have permissions to access any network shares on any server. This is the default for IIS/ASP.NET accounts for security reasons.

You can set the the "interact with Desktop" all you want. You're still not going to see anything on the clients because the Desktop you're talking about is on the server, not the client.

What you really trying to do with this?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900