OK, let me preface this by stating that this is for an internal application only, so security is not a major concern and we can/do have a fair amount of control over the users browser, operating environment and configuration.

I am currently generating some hyperlinks, like this:

<a title="L7489" id="MainContent_GridView1_lnkFolderR_1" style="display: inline;" href="file:///W:\SYD\L\L7489">

These links do work, and the user can open the directory by clicking the link as expected. (This only works in IE, but as it is internal use only and a controlled environment, this is acceptable)

Now they want the application to automatically create the directory if it doesn't exist, and then link to it. I thought about trying this in javascript, but obviously there are design/security restrictions on accessing client side file system through javascript.

I can convert the anchor tag to an aspnet link button, and perform the directory check and creation on the server side. However, I am at a loss as to how I push the open folder command back to the browser.

In previous instances I have been able to dynamicaly generate an print a window.open() javascript call, but this doesn't work for local file paths.

  • Is there anyway to push a new window redirect or something from the server side code?
  • does anyone know a way to make it work via javascript in either case?
5 Years
Discussion Span
Last Post by |-|x

Never mind.... I figured out how to do it with window.open()

It just requires the right number and escaping of the right types of slashes, and well formed tags and script code embeded in the right place in the page. Very finicky, but it works. Again IE only.

Would love if someone had a way to make this work cross-browser, but at least its functional.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.