locked
Not Able to open shared folder path as file explorer from IIS.Works fine in Local but not on server. RRS feed

  • Question

  • Hi,

       I have requirement where i need to open shared file path on button click as file explorer in mvc application.

    i am using below code.

    IIS version is 8.5 in win 2012 server.Using Windows authentication.

    And application pool runs under networkservice

    This code works fine in my local but not on server.I am physically able to open folders from server though.It does not log any error but folder explorer does not open from server.

    public ActionResult EvidenceFolder(string PageFrom, string Assetid, string id)
            {
                OpenFolder(@"\\backup\MIS\OL Property Services\PS5 Property & Portfolio Management\Compliance\FIRE RISK ASSESSMENT\Evidence Folders\" + Assetid);
              
                if (PageFrom == "ReviewActions")
                {
                    return RedirectToAction(PageFrom, "Landing", new { id = id });
                }
                else
                {
                    return RedirectToAction(PageFrom, "Landing", new { ActionID = id });
                }
            }

    private void OpenFolder(string folderPath)
            {           
                try
                {              
                    if (Directory.Exists(folderPath))
                    {                   
                        ProcessStartInfo startInfo = new ProcessStartInfo
                        {
                            Arguments = folderPath,
                            FileName = "explorer.exe",
                            WindowStyle = ProcessWindowStyle.Normal,
                            WorkingDirectory = Path.GetDirectoryName(folderPath),
                            UseShellExecute = true
                        };                  
                        Process.Start(startInfo);
                        
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("Exception:" + ex.Message);
                }
            }

    Please help me with this.

    Tuesday, March 13, 2018 4:17 PM