Click to See Complete Forum and Search --> : Redirect user or close window after BinaryWrite
tacallah
05-23-2003, 01:15 PM
I have an ASP page that sends output to printer:
Response.Clear
Response.ContentType = "application/postscript"
Response.BinaryWrite poRsFromBll("mFtsSf135")
Response.Flush
This works, but I would like to either redirect the user to another page or simply close the window when finished. Unfortunately, I cannot do a Response.Redirect after the BinaryWrite since the headers have already been written. When I do a "window.location.href = ..." or a window.close, the JavaScript command is sent to the printer. Any suggestions would be greatly appreciated!
Tim
tacallah
05-23-2003, 11:36 PM
Right now, it is the main window, but I could easily make it a pop up window using window.open from the main window. Maybe, it would help if I explain what I am doing. I have an ASP page that returns text from a call to a COM DLL. I need to send this text to a label printer. Using BinaryWrite works, but it leaves the user on a blank page after printing is complete.
I would rather not have the user stay on a blank page. At first, I thought I could redirect the user with response.redirect, server.transfer, or JavaScript (window.location.href). None of these worked. It seems that once I set the ContentType, any output sent to the browser is sent to the printer.
Next idea would be to pop up a window using window.open with the ASP code from the eariler post and doing a window.close. I have not tried this, but I assume the window.close command will be sent to the printer. Maybe there is better solution to my problem. Any ideas?
I really appreciate your help!
Tim
tacallah
05-24-2003, 10:06 PM
Thanks for the reply! The printing is actually pretty easy to do. On the client computer, I go into Folder Options and add a new file type for PS files. I have all PS files open with print.exe.
I had some limited success with using the META tag:
<META HTTP-EQUIV="Refresh" CONTENT="10;URL=SomePage.asp">
This is sort of your timer approach, that is, wait ten seconds and redirect user.
Thanks again for help! If I come up with something different, I will let you know.
Tim
gitolekha
06-24-2008, 02:35 AM
Hi,
I am doing the download proces in a pop-up window and want to close the pop-up after the download completes and the Save dialog box appears. But I am unable to close the window, even through javascript. it seems that after Response.BinaryWrite no other script works. Can anyone please help me. !!!