Wrox Programmer Forums
|
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 14th, 2008, 04:53 PM
Registered User
 
Join Date: Oct 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Opening a new window issues...

I am trying to get a window to open when someone clicks a link. The link is created using a Response.Write. It works if I use something like this:

Code:
Response.Write("<a href='http://fallenscribe.com' target='_blank'>Test</a><br />");
But as soon as I put a file in there (what I am really trying to open in a new window), it wont work. Here is what I am doing for that:

Code:
Response.Write("<a href='file:///" + location + "OutputReports\\xmlTrans" + tick + ".html' target='_blank'>Open the Business Report in a new window</a>");
I have turned off Pop Up blocker, done everything I can think of, but it just doesn't open. I get no errors as to why, either. Anyone have an idea as to why the second one won't open but the first will?

edit: I can also Right Click -> Copy URL and paste it into a new tab and have it work that way as well. So the href is correct, it just doesn't open when you click it...
 
Old October 15th, 2008, 03:04 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Where does this code run?

'file:///" + location + "OutputReports\\xmlTrans" + tick + ".html'

file:// runs on the client; not the server. So, something like

file://c:\SomeFile.txt would be searched for at the client, not the server.....


Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old October 15th, 2008, 07:46 AM
Registered User
 
Join Date: Oct 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Imar
 Where does this code run?

'file:///" + location + "OutputReports\\xmlTrans" + tick + ".html'

file:// runs on the client; not the server. So, something like

file://c:\SomeFile.txt would be searched for at the client, not the server.....
The code writes the links to the pages, it isn't actually executing it from the server. It's meant for the client to click the link. And we got it working; I had the right idea, just wrong syntax. We changed it from "location+'\\OutputReports........" to just "~/OutputReports..." and that's what did it. Stupid little things like that piss me off :P

 
Old October 15th, 2008, 08:13 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

...which reinforces what Imar said. The ~ character evaluates a path that exists on the SERVER whereas file:// evaluates a path on the CLIENT.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old October 15th, 2008, 04:27 PM
Registered User
 
Join Date: Aug 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to devendrac7
Default


first u need to evaluate why u want to use "'file:///"
If u are planning to open a file which is not stored on a webserver (localhost or any site on other than 8080/80port), then u can not open that HTML file.
Instead what u can do is that
if the file is located on the file system, then u can give the neccessary rights to the directory on the machine and read the file using FileSystem object and throw all the content on the newly opened window. But for that u will need an intermediate page which will take the input as the fileName.

I am sorry if this is not what you are looking for... From your Code I wrote what I understood.


D.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening a New Window GailCG ASP.NET 2.0 Basics 14 April 1st, 2008 11:32 AM
opening a new window rgpassey Javascript How-To 2 September 14th, 2005 11:38 AM
Opening New Window p_nut33 Classic ASP Basics 1 August 6th, 2004 08:11 PM
Close Parent window on opening child window pkdev Javascript How-To 8 April 11th, 2004 12:06 PM
Opening New Window james_sellwood ASP.NET 1.0 and 1.1 Basics 5 June 12th, 2003 11:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.