473,660 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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('fi le://C:/DEV/Procurement2008/ProcurementSyst em/Images/
dbStylemaster.p pt')
}
</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 3320
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('fi le://C:/DEV/Procurement2008/ProcurementSyst em/Images/
dbStylemaster.p pt')
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(an y 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('fi le://C:/DEV/Procurement2008/ProcurementSyst em/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('f ile://C:/DEV/Procurement2008/ProcurementSyst em/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
8836
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 (same folder). The cookie is not received. Can someone explain why? I worked around this by adding a cache-control header with a value of no-cache. This fixes the problem. Unfortunately that causes another problem with Internet Explorer...
12
12421
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, 'height=200,width=400,status=no,toolbar=no, menubar=no,location=no resizable=no scrollable=no'); but I can't seem to invoke the client side script from within a Server Side Form. I know I can use the context with to Response.redirect or Server.transfer to return a
14
11074
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 window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin = window.open('images/KJV-THANKS.gif', 'Thanks', 'width=243,height=420,'); cwin.focus();
29
4998
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 window properly but does not pass the parameter. (this is part of a coldfusion template) <a href="##"
18
3325
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 the image. The desired behavior is that when the pop-up is invoked, I want the underlying window to stay put. I don't have this problem when I run the code on my local computer but I do have it when I run the code on geocities.
0
1471
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 opens and the download starts. When the download is cancelled or completed the window automatically closes, which is exactly what I want to happen. The issue is that in IE7 Beta 2 the window just stays open. I've tried using a simple aspx page...
4
1782
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
6395
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 to look a and I am loosing tremendious amounts of time trying to organize it so that I could view it. Regards, Alexandre Brisebois
6
19256
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 know, this shouldn't be an issue, but I just can't get it to work. The script only needs to work with Firefox/Mozilla, so XP code isn't an issue. I have tried to open a window like so.
16
615
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 window.opener.document.getElementById(<%=txthidden.ClientID %>").value=selectedDate; where window.opener is pageA.aspx but am confused bkoz many pages r using this calendar.aspx page and it
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8539
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2759
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 we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.