[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

Using HTML in an ASP.Net page. <a href> tag - trying to open a local HTML document.

I've created an aspx page in my project.  I want to click on a link to open a document stored on my computer.  The screen loads, but when I click on the link nothing happens.  Some Google searching revealed that the syntax could be tricky.  I've tried some variations, but this one works in Foxfire, which one article stated, should give me my HTML ref.  

First, Any reason I can't do this?  Second, Any suggestions to correct this for a local machine?
path being my directory structure.  

<a href="file:///D:/path/Desktop/HELLOWORLD.html" target= "_blank">

Any help is appreciated.
0
dcurry22
Asked:
dcurry22
  • 3
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
You may be able to get that to work in a file you have loaded locally but not thru a web server.  If you put that file on a web server and load it with 'http://', then the link to the local file will not work.  Browser security prevents external web sites from loading local files.
0
 
Dave BaldwinFixer of ProblemsCommented:
0
 
dcurry22Author Commented:
Thanks for the Response!  I believe I've figured it out.  I need to place the document inside the directory structure of my application.  Running the application on my PC, IIS won't allow me to go outside of the application's root directory, thus storing the document on my desktop, I can't access it through my application.

I understand the local vs. web server distinction in your answer.  I was just trying to use some different document handling options, and couldn't get it to work.  

Also, could you be a little more specific on which part of browsersec/wiki/Part 2 I should read?  Thanks, there's alot out there.
0
 
Dave BaldwinFixer of ProblemsCommented:
The reason there is a lot in that article is because each circumstance seems to have a slightly different rule.  I suggest you read the whole thing once.  You might look at Part 1 also.

It is always simplest to put the documents inside the web directories so you don't have to use "file://" to access them.
0
 
gopaltaydeCommented:
javascript window.open('C:\test\abc.pdf'); worked in my case.
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now