How to open an HTML page stored on a client machine from an aspx page

I am developing an asp.net application in which I open an HTML page that is stored on the client machine on this page. I have a link that will open an aspx page on the server. On this aspx page, I have a button that will open another html page stored on the client machine. Since I am new to web development, plz help me and offer me some solutions for this ASAP.

Thank....

Edited to add:

Is it possible to navigate between HTML pages on the client machine and ASPX pages on the server without loading the HMTL file on the server. Can I use javascript code on an aspx page to open my locally saved HTML page ...

+3
source share
5 answers

try it <a href="file:///c:\whatever.txt">click to open whatever</a>

+4
source

The only way to access files on a client computer is to download them to you.

+1
source

, , HTML- ( , ).

, , , .

0

, , . , ASPX HTML , .

0

, 2 :

  • aspx html
  • html .

nr 1, html (, C:\SomePath\LocalFile.html), :

 <a href="file:///C:\SomePath\LocalFile.html">

, javascript.

, (.. ), .

   window.location.href=document.getElementById('fileInput').value;

, ..

To solve nr2 , you probably need to add javascript (which is disabled by default for local html files !!) and use "history.previous" to find the path to your public aspx page. Something is fine:

   window.location.href= history.previous.replace("myfirstpage.aspx","redirectedpage.aspx"); 

who will send someone who came to the current page, say, " http://www.publicserver.com/myfirstpage.aspx ", will be redirected to " http://www.publicserver.com/redirectedpage.aspx ",

0
source

Source: https://habr.com/ru/post/1750233/


All Articles