Open an uploaded PDF file in new browser window/tab
<p>In my current project, I need to open a PDF file which has been uploaded by the user. I have a file upload control and an Upload button on my aspx page. As soon as user clicks on Upload button, the file should be saved and opened in a new window.</p>

<p>I tried doing this using client-side function:</p>

<pre><code>        &lt;script type="text/javascript"&gt;
           function openPDF() {
           alert('The file is open.');
           window.open('Open PDF.aspx','PDF');
           return true;
          }
       &lt;/script&gt;
</code></pre>

<p>But the "Open PDF.aspx" page is blank.</p>

<p>Open PDF.aspx.cs file looks like this:</p>

<pre><code>        protected void Page_Load(object sender, EventArgs e)
        {
             string fullFileName = Session["fullFileName"].ToString();
             WebClient client = new WebClient();
             Byte[] buffer = client.DownloadData(fullFileName);

             if (buffer != null)
             {
                  Response.ContentType = "application/pdf";
                  Response.AddHeader("content-length", buffer.Length.ToString());
                  Response.BinaryWrite(buffer);
             }
       }
</code></pre>

<p>The full file path along with the filename is constructed in BtnUpload_Click event which is a server-side event, and is executed after the client-side function. 
How can I pass the full file path as a session or querystring to "Open PDF.aspx" page?</p>

<p>If there is any other way of accomplishing this, then please throw in your idea. Thanks!!!</p>
