473,490 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Opening a local file in a browser

Hi,

I'm writing a web app in VS.NET 2003, part of which allows users to download
reports in the form of XML documents to their local machine for further
processing. I'm using a 3rd-party Java applet to do this, and it works
perfectly.

However, I'd like to be able to offer users the ability to view the XML
documents once they've downloaded them. I thought I could do this by
providing a simple hyperlink, but I must be doing something wrong because
it's not working.

E.g. let's say they've downloaded a document called 20050122091003.xml into
the root of their C:\ drive. I created a hyperlink control which, when I do
a View Source in the HTML that ASP.NET generates, looks like this:

<a target="_blank"
href="file:///C:/20050122091003.xml">C:\20050122091003.xml</a>

However, when I click it, nothing happens. But, if I take the href portion
of the hyperlink and paste it into the Address box of a browser window, it
opens perfectly.

What am I doing wrong?

Any assistance gratefully received.

Mark Rae
Nov 19 '05 #1
5 2060
Mark,

This is actually a browser security feature; it has nothing to do with your
application in particular. If the browser in question is IE, the simplest
workaround is usually to add the site to the trusted sites list. Of course,
this should only be done if the site is actually sufficiently trustworthy to
merit this.

HTH,
Nicole
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:Ot*************@TK2MSFTNGP12.phx.gbl...
Hi,

I'm writing a web app in VS.NET 2003, part of which allows users to
download reports in the form of XML documents to their local machine for
further processing. I'm using a 3rd-party Java applet to do this, and it
works perfectly.

However, I'd like to be able to offer users the ability to view the XML
documents once they've downloaded them. I thought I could do this by
providing a simple hyperlink, but I must be doing something wrong because
it's not working.

E.g. let's say they've downloaded a document called 20050122091003.xml
into the root of their C:\ drive. I created a hyperlink control which,
when I do a View Source in the HTML that ASP.NET generates, looks like
this:

<a target="_blank"
href="file:///C:/20050122091003.xml">C:\20050122091003.xml</a>

However, when I click it, nothing happens. But, if I take the href portion
of the hyperlink and paste it into the Address box of a browser window, it
opens perfectly.

What am I doing wrong?

Any assistance gratefully received.

Mark Rae

Nov 19 '05 #2
You could achieve the feature this way.

Keep a copy of the file on the server, and stream it to the browser when
they click to view, so it will be a replica of the file they have on their
disk. Since it will be readonly, it will not be an issue.

Or, if the file is small enough, you can keep it in memory and stream it
from memory.

You could just keep the memory on server disk/memory until they confirm/deny
the option to view it on screen to manage server resources.


"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:Ot*************@TK2MSFTNGP12.phx.gbl...
Hi,

I'm writing a web app in VS.NET 2003, part of which allows users to
download reports in the form of XML documents to their local machine for
further processing. I'm using a 3rd-party Java applet to do this, and it
works perfectly.

However, I'd like to be able to offer users the ability to view the XML
documents once they've downloaded them. I thought I could do this by
providing a simple hyperlink, but I must be doing something wrong because
it's not working.

E.g. let's say they've downloaded a document called 20050122091003.xml
into the root of their C:\ drive. I created a hyperlink control which,
when I do a View Source in the HTML that ASP.NET generates, looks like
this:

<a target="_blank"
href="file:///C:/20050122091003.xml">C:\20050122091003.xml</a>

However, when I click it, nothing happens. But, if I take the href portion
of the hyperlink and paste it into the Address box of a browser window, it
opens perfectly.

What am I doing wrong?

Any assistance gratefully received.

Mark Rae

Nov 19 '05 #3
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:eO**************@TK2MSFTNGP15.phx.gbl...

Nicole,

Thanks for the reply.
This is actually a browser security feature; it has nothing to do with
your application in particular.
I see.
If the browser in question is IE, the simplest workaround is usually to
add the site to the trusted sites list.
Yep - that works.
Of course, this should only be done if the site is actually sufficiently
trustworthy to merit this.


Since I'm building the site, I'm confident of its trustworthiness... :-)

Mark
Nov 19 '05 #4
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
<snip>
Since I'm building the site, I'm confident of its trustworthiness... :-)


Really? Do you allow any user-provided text to be displayed in any page
without HTML-encoding? If so, your site is probably vulnerable to
cross-site scripting attacks, and it shouldn't be added to the trusted sites
zone. Personally, I make every effort to ensure that my applications
HTML-encode every bit of dynamic text that might end up in any page, but I
still worry since there's always the chance I missed one somewhere...

Other points of potential risk are things like allowing users (even highly
privileged users) to specify the local file to be opened by one of your
file: protocol links. This sort of thing could allow one user to force
local execution of potentially malicious code on another user's computer,
within the context of the launching user's account.
Nov 19 '05 #5
"Tarren" <no***********@thanks.com> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
You could just keep the memory on server disk/memory until they
confirm/deny the option to view it on screen to manage server resources.


That might be the best solution - thanks.
Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6921
by: Bob Murdoch | last post by:
I've got an intranet application that presents a list of files in sort of a 'central repository' web page. Each file is an href in the form <a href=file://server/share/path/filename.ext>. When...
3
3495
by: Clinton Goff | last post by:
I am attempting to write a javascript app that will open a second browser window, load a url, such as www.google.com (foreign url) and perform a <File-Save As> function on that window. I am able...
9
1535
by: Karel | last post by:
All, I am completely new to Javascript but I have read some articles and examples about opening new windows from a webpage. However I am trying to open a data file ( in html format) that is...
14
11016
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
2
3916
by: Pat Sheen | last post by:
In IE6 I'm using the following html to have three frames. One of the frames is to open a locally stored MS Word document. <frameset rows="100,1*"> <frame name=SiteHdr...
4
1731
by: Thomas Scheiderich | last post by:
I can't seem to open a word document from any of my browsers except the one on my web server. Here is the .aspx file: ***************************************************************** <%@...
5
3300
by: Brad | last post by:
In several aspx applications I export crytal reports to pdf, xls and doc files and then the aspx page writes the selected export file to the client browser. This all works with one small quirk: ...
6
1674
by: jonefer | last post by:
I have two versions of a 'Downtime Application that will run in the event that the mainframe goes down 1) SQL Server ASP.NET app (accessed outside the mainframe network) 2) MS Access Version of...
1
3029
by: celoftis | last post by:
BACKGROUND: I have some PPT slides that have been converted to HTM (ensuring that the show slide animations while browsing checkbox is checked). The original HTM slides have custom animations to...
0
7108
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4875
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.