ASP.NET/Opening PDF document in a new browser

  • Thread starter Thread starter Gabe
  • Start date Start date
G

Gabe

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 ([email protected]) as well
as the group; thanks!

Gabe
 
Back
Top