ASP.NET View PDF in the webpage
<p>I am trying to put a pdf document in a a web page. But instead of viewing this in the web page, when this page is called it ask's if we want to save/download an then open this in Adobe with the printer dialog open.</p>

<p>Javascript which calls this page load function</p>

<pre><code> window.open("http://localhost:1843/PrintDocument.aspx?DocumentId="+id+"&amp;Year="+year+"&amp;Location="+loc);
</code></pre>

<p>ASPX CODE BEHIND , Page load function:</p>

<pre><code> protected void Page_Load(object sender, EventArgs e)
        {

            Response.ContentType = "Application/pdf"; 
            string yr = Request.QueryString["Year"].ToString();
            string Dyr = Convert.ToDateTime(yr).Year.ToString();
            string Location = Request.QueryString["Location"].ToString();
            string DocumentID = Request.QueryString["DocumentId"].ToString();    
            string PDFFile = string.Format(@"\\abc\def\pqr\{0}\{1}\{2}.pdf", Dyr, Location.Substring(0, 4), Location.Substring(4, 4));
            //Response.AddHeader("content-disposition", "attachment; filename=document.pdf");
            Response.WriteFile(PDFFile);
            Response.End();
        }
    }
</code></pre>
