Akash Agrawal
Akash Agrawal

Reputation: 51

Unable to Open folder in asp .net website

I am a fresher and working on a web application using ASP.Net C# 4.5, VS 2012. I want to open "ixo-global" folder at another server \10.23.23.23\ixo-global\ (Just this folder). I did this using following code:

Code 1

ProcessStartInfo startInfo = new ProcessStartInfo(FolderPath);
startInfo.WindowStyle = ProcessWindowStyle.Normal;
Process.Start(startInfo);

Code 2

System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo()
{
FileName = FolderPath,
UseShellExecute = true,
Verb = "open"
});

Each works when I ran this code on Localhost. But after publishing this on IIS, it does not open folder at Client's browser. This may be due to security measure. I am able to access this folder using Run on server where IIS is installed. I referred this link, code runs but folder does not open at client browser.

What can I do? TIA.

Upvotes: 1

Views: 1222

Answers (3)

D Stanley
D Stanley

Reputation: 152634

You are starting a process on the server, not on the browser's desktop. When you run it locally, you are the server, so you see the explorer window open. When you publish to a different server, explorer opens on the server, so you can't see it.

There's not a way to open up an explorer window to view files on the server unless the client has:

  • A direct path to the folder (e.g. via a file share)
  • permission to access the folder.

You might also look at third-party controls that let you "browse" the server' files in a explorer-like window, or if the client does have access to the folder directly (meaning if the client could browse to the folder in explorer) then you could put the path to the folder in a file:// link and display that in the client's browser.

Upvotes: 1

Anibal Díaz
Anibal Díaz

Reputation: 111

"System.Diagnostics.Process.Start" don´t work on web context, only work in desktop applications.

Upvotes: 0

makoulis
makoulis

Reputation: 33

Did you checked if the folder has read rights only?

Upvotes: 0

Related Questions