473,800 Members | 2,614 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Close window after file transmit (ASP)

Hi all,

This is partially a .NET question and partially scripting (whichever works :)

I recently wrote a vCard parser that sends vCards directly to the brower as a stream. After the file is transmitted I need to close the window, but I can't get anything to works because I’m ‘hijacking’ the Response.Write method.

Here is a small snippet of the code:

string strDN = "CN=Brigit Runge,OU=TestUs ers,DC=engineer ing,DC=somewher e,DC=com";
DirectoryEntry deUser = new DirectoryEntry( "LDAP://server/" + strDN);

string strCN = deUser.Properti es["cn"].Value.ToString ();
string strvCard = BuildvCard(deUs er);

Response.AddHea der("content-disposition", string.Format(" attachement; filename={0}.vc f", strCN));

Response.Conten tType = "text/x-vcard";

Response.Write( strvCard);

Response.Write( "<script>self.c lose();</script>");

//Response.End();

I've tried a number of script attempts, from onClick to onBlur. Any successful window closing prohibits the actual file transfer. I could use a timer, but I want to make sure the file actually gets sent.

Any ideas?

Thanks,
Bill

Jul 21 '05 #1
1 2447
I decided the better way was to separate the functionality and make a second
page. I was using two pages anyway, a window with an iframe pointing to the
real window. It is possible to post back to a modal dialogue, but posting
back a file wasn't working. Instead of opening the save/open window, the
modal was going blank -- consequently I resorted to the iframe/modal hack.

The solution:
Open a second window that simply renders the vCard and then have the modal
close itself.

Remember that to get a modal to postback and close itself you must:

Set HTML/JScript:
<base target="_self">
window.opener = this.self;

C#:
Response.Write( string.Format(" <script>window. open('vCardBuil der.aspx?adObje ct={0}&action=b rowser');self.c lose();</script>", strPath));

Now I need to figure out how to parse a photo into a vCard, it sounds easy
but I keep crashing Outlook *evil grin*

Bill
Jul 21 '05 #2

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

Similar topics

1
5253
by: Navin | last post by:
i open the file download.asp from another main.asp page using window.open what the problem is when i clikc on the hyperlink it prompts me the ie save dialog box taht fine. but when the script ends in download.asp i wanna close the download.asp .asp window open in background.. but that not working. how to close the window download.asp as i wanna save the content in text format i dont wnat to use the body unload event handler as the
1
4535
by: Joe D | last post by:
I think this is a simple question. But I am new to JS. Here is what I want to do: From a parent window, open a popup window (child) to get data from user, then user submit the request, close the child window, an ASP page is generated from server and displayed with data in parent window, rather than child window. Right now, I can display in child window. But do not know how to display in parent. TIA
6
8539
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the page forcing the download dialog to appear. This all works fine. If the user selects "Open" or "Cancel", the window closes, which is the desired behavior. If they select "Save", the location dialog shows up, they save the file and the window remains open. I've tried a number of things to get...
1
446
by: Bill Belliveau | last post by:
Hi all, This is partially a .NET question and partially scripting (whichever works :) I recently wrote a vCard parser that sends vCards directly to the brower as a stream. After the file is transmitted I need to close the window, but I can't get anything to works because I’m ‘hijacking’ the Response.Write method. Here is a small snippet of the code: string strDN = "CN=Brigit...
5
3095
by: lindanr | last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the <body> tag. When I click on the window's scrollbar, the window closes. The same code works fine in ASP.NET 2003. Any ideas?
9
4659
by: Stan B | last post by:
I create a popup window by calling window.showModalDialog Popup window has Ok button with this code attached: === string Script = "<script language=JavaScript>" + "{" + "window.close();" + "}" + "</script>";
37
6355
by: Jan Tovgaard | last post by:
Hey everyone:) We have a critical problem, which I can see that other people also has ran into. In Internet Explorer 7 it is no longer possible to do a window.close after opening a window, without getting a alert message that ask if u want to close the window. This did NOT happen in Internet Explorer 6, Mozilla firefox or other browsers.
0
9691
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...
0
10507
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
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
10036
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...
1
7582
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6815
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
5473
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...
2
3765
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.