473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

window.open issue

Hi All,

I am attempting to do something I thought would be simple. From one
of my asp.net pages, I need for the user to be able top open up
documents(any file format - .xls, .doc, .pdf, etc). To accomplish
this, I am using javascript:

<code>
<script type="text/javascript">
function open_win()
{
window.open('file://C:/DEV/Procurement2008/ProcurementSystem/Images/
dbStylemaster.ppt')
}
</script>
</code>

I am getting "Access is Denied".

This file I am trying to open is on my hard drive and I am running the
asp.net program locally as I am developing. Eventually, the files
will be stored on a web server.

I have done a lot of searching this morning and am just more
confused. Am I attempting to do something that won't be allowed
because of security?

Thansk in advance for your help!

JCC
Aug 4 '08 #1
5 3311
JCCDevel wrote:
I am attempting to do something I thought would be simple. From one
of my asp.net pages, I need for the user to be able top open up
documents(any file format - .xls, .doc, .pdf, etc). To accomplish
this, I am using javascript:

<code>
This is Usenet. Please do not bother (us) with pseudo-tags.
<script type="text/javascript">
function open_win()
{
window.open('file://C:/DEV/Procurement2008/ProcurementSystem/Images/
dbStylemaster.ppt')
For a proper file:// URI, you need to add another slash before the C: to
specify the local host. (The `localhost' host name after it is optional then.)

But this method only constitutes overhead.
}
</script>
</code>

I am getting "Access is Denied".
^^^^^^^^^^^^^^^^
This file I am trying to open is on my hard drive and I am running the
asp.net program locally as I am developing. Eventually, the files
will be stored on a web server.

I have done a lot of searching this morning and am just more
confused. Am I attempting to do something that won't be allowed
because of security?
That much would be obvious, would it not?

You are attempting to access a file:// resource from a http(s):// resource.
The client application does not care, because it cannot know, that both are
on the same machine. So access is denied.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Aug 4 '08 #2
Thomas 'PointedEars' Lahn a écrit :
JCCDevel wrote:
>I am attempting to do something I thought would be simple. From one
of my asp.net pages, I need for the user to be able top open up
documents(any file format - .xls, .doc, .pdf, etc). To accomplish
this, I am using javascript:

<code>

This is Usenet. Please do not bother (us) with pseudo-tags.
This is Usenet. Don't talk in the name of the whole group, don't say
*us* there is no "us".

Talk in your OWN name, thanks.

--
laurent
Aug 4 '08 #3
On Aug 4, 1:43 pm, JCCDevel <JCCMo...@gmail.comwrote:
window.open('file://C:/DEV/Procurement2008/ProcurementSystem/Images/
You could write a tiny http "server" for the localhost, e.g. listening
on ip 127.0.0.1:80 then use URL of the form http://c/path where this
tiny server converts /c/path into c:\path to open and read whole file
into a buffer, then send it to the socket. I have done something like
that (also for code development) by rigging our existent http server
source (the iPhone remote desktop & file server, http://f2p.com ) with
that kind of custom file i/o. You can probably find some tiny http
server source on the web and spend few hours on customization. That
scheme also lets you dump js debug strings (e.g. via XMLHttpRequest)
to the console on the server side, without disrupting display on the
client side.
Aug 4 '08 #4
wayne wrote:
On Aug 4, 1:43 pm, JCCDevel <JCCMo...@gmail.comwrote:
>window.open('file://C:/DEV/Procurement2008/ProcurementSystem/Images/

You could write a tiny http "server" for the localhost, e.g. listening on
ip 127.0.0.1:80 then use URL of the form http://c/path where this tiny
server converts /c/path into c:\path to open and read whole file into a
buffer, then send it to the socket.
ISTM this server would listen, but would not hear anything. In this URI,
`c' would be the host name, and that is what would have to be defined in the
local `hosts' file as an alias for `localhost', as an alternative DNS record
would be either invalid or complicate maintenance.
I have done something like that (also for code development) by rigging
our existent http server source (the iPhone remote desktop & file server,
http://f2p.com ) with that kind of custom file i/o.
That was probably http://localhost/c/...
You can probably find some tiny http server source on the web and spend
few hours on customization.
I would probably use a very basic TCP sockets based service instead; I
hacked one together using a Java tutorial[1] in about one hour, about 120
LOC (pretty-printed). I had written almost no Java code before; if you can
write J(ava)Script, you can also write this one. (Eclipse, of course, came
in very handy :))

However, the OP already has a local server with ASP .NET; I recommend to use
the existing infrastructure instead.
PointedEars
___________
[1] Abts, Dietmar: Masterkurs Client/Server-Programmierung mit Java;
pp. 106; 2. Auflage; April 2007; Vieweg & Sohn.
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Aug 4 '08 #5
That was probably http://localhost/c/...

Yep, I dopped accidentally the host above.
Aug 4 '08 #6

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

Similar topics

18
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page...
12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
14
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...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
18
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to...
0
by: Burt | last post by:
I have an ASP.NET page that performs a window.open to an HttpHandler that streams a binary file to the brower. I am forcing the save_as... dialog in IE. My issue is that in IE6 the new window...
4
by: NC | last post by:
Hi All, We have an issue where if we say: window.open(uri, 'QuickTradePopup', 'width=730,height=300,menubar=no,toolbar=no,scrollbars=yes,resizable=yes').
4
by: alexandre.brisebois | last post by:
Hi, I am using access 2003, I would like to know if there is an option to reorganize the tables in a maner that is readable, as we can do in sql sever 2000 or 2005. I have been given a database...
6
by: Daz | last post by:
Hello everyone, I would like to open a child window from the parent, and add an onload event listener to the child window which will tell the parent when the document has loaded. As far as I...
16
by: CreativeMind | last post by:
hi, i have a page calendar.aspx which returns selected date i.e window.returnValue=selectedDate; window.close(); it works fine with IE but not for Firefox. i tried...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.