473,325 Members | 2,480 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,325 software developers and data experts.

ASP.NET/Opening PDF document in a new browser

I have two web forms page1.aspx and page2.aspx. page1.aspx has one
button with the following event handler:

private void OnButtonClick(object sender, EventArgs e)
{
Response.Write("<script>window.open('page2.aspx')</script>");
}

page2.aspx writes a pdf document as follows in its Page_Load()

private void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.ContentType = "Application/PDF";
Response.WriteFile("c:\test.pdf");
Response.Flush();
Response.Close();
}

On Acrobat version 5.0, clicking that button on page1 opens a new
browser and pdf documents within that browser. On version 5.1 or
higher however, it opens up a blank window (no acrobat reader buttons
either - just blank page). Has anyone got this working? Is it
..NET/Acrobat reader bug? Or is there some settings that I need to set
in the reader itself?

Please send your answers to my e-mail (bo********@yahoo.com) as well
as the group; thanks!

Gabe
Nov 18 '05 #1
1 3630
make sure you do not have any html code in the aspx page.
"Gabe" <bo********@yahoo.com> wrote in message
news:d5*************************@posting.google.co m...
I have two web forms page1.aspx and page2.aspx. page1.aspx has one
button with the following event handler:

private void OnButtonClick(object sender, EventArgs e)
{
Response.Write("<script>window.open('page2.aspx')</script>");
}

page2.aspx writes a pdf document as follows in its Page_Load()

private void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.ContentType = "Application/PDF";
Response.WriteFile("c:\test.pdf");
Response.Flush();
Response.Close();
}

On Acrobat version 5.0, clicking that button on page1 opens a new
browser and pdf documents within that browser. On version 5.1 or
higher however, it opens up a blank window (no acrobat reader buttons
either - just blank page). Has anyone got this working? Is it
.NET/Acrobat reader bug? Or is there some settings that I need to set
in the reader itself?

Please send your answers to my e-mail (bo********@yahoo.com) as well
as the group; thanks!

Gabe

Nov 18 '05 #2

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

Similar topics

2
by: Jawahar Rajan | last post by:
All, I have a printer friendly page that is opened when a user clicks a link on my page to get the printer friendly version, How ever when they close out the printer friendly version and return to...
1
by: Display Name | last post by:
the customer I'm developing a site for uses a canned form-parsing page that allows her to have an email subscription opt-in page add emails to a list she can manage using a link that you point your...
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...
4
by: Thomas Scheiderich | last post by:
I can't seem to open a word document from any of my browsers except the one on my web server. Here is the .aspx file: ***************************************************************** <%@...
2
by: Matt Hamilton | last post by:
I have an application page with a datagrid with a checkbox on each row. The user should check the rows they want to modify and then click a button. When the button is clicked, I have a Click...
8
by: Vigneshwaran G via DotNetMonster.com | last post by:
Hi , I am in need of opening a new IE browser with an URL from my windows form, coded in vb.net. I tried with the following code. Dim psi As New ProcessStartInfo psi.FileName = "iexplore"...
5
by: Cedric | last post by:
Hi Folks, I'm wondering if someone has already succeed to open a word2000 document located on server side with javascript code executed by a web browser on client side. In fact, i make it...
1
by: Greg Smith | last post by:
Is there a way to control the opening size of the browser?
8
by: paintedjazz | last post by:
I am using the following javascript to make a popup menu allow the user to navigate to different pages on a website. Yet it is opening windows as if I have <base target="some-name"> defined in the...
1
by: captainwin | last post by:
Here's the problem: - Website is ASP.NET 1.0 - Server is Windows Server 2003 - Browser is IE 6/7 - Client requests a mail merged MS Word 97 - 2003 document on the website, and the document gets...
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
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...
1
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.