The user has a list of files of different extensions. When he double-clicks a file, the corresponding file viewer should open.

I do it like this:

System.Diagnostics.Process.Start(Path.Combine(LocalFileManager.workingFolder, localFilePath)); 

When the service is installed on another machine, the client will not see anything.

How to make the corresponding program open on the client?

    2 answers 2

    Of course, the client will not see anything, because your code is executed on the server side. To open you need to use the JS tools (see, for example, here and there ).

      In the end, I did this:

      WebApi method:

       [HttpGet] public string GetFilePath(string fileName, Guid categoryId, Guid userId) { using (var _client = new DataServiceClient("epData")) { if (Properties.Settings.Default.Domain != "") { _client.ClientCredentials.Windows.ClientCredential.UserName = Properties.Settings.Default.Domain + "\\" + Properties.Settings.Default.Login; _client.ClientCredentials.Windows.ClientCredential.Password = Properties.Settings.Default.Password; } _client.SetCurrentUser(userId); var category = _client.GetAttachmentCategory(categoryId); LocalFileManager.SetWorkingFolder(category); } var serverName = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + HttpContext.Current.Request.ApplicationPath; var result = Path.Combine(serverName, LocalFileManager.shortWorkingFolder, fileName); return result; } 

      Ie, the GetFilePath method simply returns the url path to the file on the server.

      And then through Angularjs, everything as shown in this example (just copy / paste): https://stackoverflow.com/questions/24080018/download-file-from-an-asp-net-web-api-method-using-angularjs

      In IE 11 it also works as it should, if done as shown in Internet Explorer 11 Support (Fixed).