1

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.

Community
  • 1
  • 1
  • What is the end goal? Why does the client need to browse the server's files? – D Stanley May 13 '16 at 12:46
  • yes. It's a folder on shared path. Right now all permissions are granted to this folder – Akash Agrawal May 13 '16 at 12:54
  • But what is the user supposed to _do_ once the folder is open? Add a file? Delete all the files? Pick one and open it? – D Stanley May 13 '16 at 12:55
  • sorry for incomplete info in earlier comment. We have a specification file (pdf) for each product. Each Product will have their respective folder with their respective specs file int it. Folder name is equal to Product Code. User can open folder and read file for any Product listed in GridView – Akash Agrawal May 13 '16 at 13:07
  • any solution ? or free third party tool worth giving a shot ? – Akash Agrawal May 18 '16 at 07:10

3 Answers3

1

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.

D Stanley
  • 149,601
  • 11
  • 178
  • 240
0

Did you checked if the folder has read rights only?

makoulis
  • 33
  • 5
0

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

Anibal Díaz
  • 111
  • 7