2

I want to provide a means to open up Windows Explorer (or at least view the directory contents) via an internal webpage I've developed for our business. There are several machines which we share over the internal network. I've provided a text entry field for allow the user to enter the folder path they want to associate with a given row in a DB table and I can store that info off and create the file://///10.10.5.10/Recipes/Pie link to the Pie recipe folder on one of our shared machines.

The link renders correctly on the page and if I copy the link info and paste it into the address bar it will display a navigable page in FireFox or open Windows Explorer if using IE.

However, the link does nothing if you click on it directly on my page. I suspect this might have something to do with security and the brower, right? I've seen a SharePoint page in someone else's system that did work, but I'd guess that has to do with some differences between SharePoint and a webpage in a browser. The work-around of right-clicking the link and copy/pasting it into another tab will work and I might have to live with this, but I was wondering if anyone had any suggestions or ways to deal with this issue. Perhaps I'm just doing something wrong, but I'm pretty sure it's browser-security related.

itsmatt
  • 31,265
  • 10
  • 100
  • 164
  • 1
    can you provide a very simple (static html) example which reproduces the behaviour ? and which browser(s) ? – Yahia Sep 12 '11 at 13:35
  • @Yahia, if I build a very simple html with just the link in it, double-click from explorer, it'll open in IE and when I click the link, it asks me to verify if I want to open Windows Explorer. I don't get this behavior with the webpage I did in ASP.NET MVC. – itsmatt Sep 12 '11 at 13:48
  • then this is definitely an issue of browser security... in which zone is your ASP.NET app ? – Yahia Sep 12 '11 at 13:49
  • "Local intranet", if I'm answering the question I think you're asking. – itsmatt Sep 12 '11 at 14:12
  • Have you tried putting it client-/browser-side into "trusted sites" ? – Yahia Sep 12 '11 at 14:26
  • @Yahia - didn't see how to do this in FireFox, assuming that I'm following you. – itsmatt Sep 12 '11 at 23:30
  • I was on IE... I will have to think more about FireFox then... btw: the answers below are all server-side and would only help IF you are accessing the UNC path from your app directly... – Yahia Sep 13 '11 at 08:08

3 Answers3

1

Most likely it's a permission issue. ASP.net runs under the ASP.net process account. Look for the ASPNET user and apply permissions to the folder for the user in question.

JonH
  • 32,732
  • 12
  • 87
  • 145
1

It definitely sounds like a security issue. Try one or both of the following:

  • Try using impersonation to impersonate a domain user with sufficient priveleges to access explorer on the client's machine
  • If this is a small intranet application, give the application full trust on the client

Here's a link to a class you can use for impersonation - see my answer:

Invoke or call C# console app from C# web service?

Community
  • 1
  • 1
James Johnson
  • 45,496
  • 8
  • 73
  • 110
1

It seems for me as a pure Internet Explorer setting issue.

First of all I would recommend you better use UNC or DNS names in the path to the server instead of the usage of IP addresses: use file://///myserver/Recipes/Pie or file://///myserver.mydomain.com/Recipes/Pie instead of file://///10.10.5.10/Recipes/Pie.

Second you should better include the file://///myserver, file://///myserver.mydomain.com or even file://///10.10.5.10/ to the "Local intranet" or at least to "Trusted sites" zone:

enter image description here

Then you should verify the setting of the Security Zone to which you map the url. Look at the "Miscellaneous" group for the "Display mixed contain":

enter image description here

If you would has "Prompt" setting you will see the warning:

enter image description here

at every attempt to open the link file://///myserver/Recipes/Pie

If you would has some problems I recommend you to reset the IE settings in "Advanced" tab:

enter image description here

Oleg
  • 220,925
  • 34
  • 403
  • 798