Problem in redirecting a page after a PDF download (Asp.net C#.net)
<p>I have an aspx(say 1.aspx) page from where first I am downloading a pdf file and then I want to redirect to some Thanks.aspx page. The code is this</p>

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

            string pathId = string.Empty;
            if (Page.IsValid)
            {
                try
                {    
                        pathId = hidId.Value;
                        DownloadPDF(pathId);                        

                    Response.Redirect("Thanks.aspx");
                }
                catch (Exception ex)
                {
                    throw ex;

                }
            }
        }


protected void DownloadPDF(string pathId)
        {
            if (!(string.IsNullOrEmpty(pathId)))
            {
                 try
                {
                    Response.ContentType = "application/pdf";
                    Response.AppendHeader("Content-Disposition", "attachment; filename=" + pathId + ".pdf");
                    string path = ConfigurationManager.AppSettings["Pdf_Path"].ToString() + "\\" + pathId.Trim() + ".pdf";
                    Response.TransmitFile(path);                   
                }
                catch (Exception ex)
                {
                        throw ex;
                }
                finally
                {

                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                }
            }
        }
</code></pre>

<p>The problem is that, the file save dialog is coming properly and I am able to download the file also, but it is not getting redirected to the Thanks.aspx page.</p>

<p>How to resolve this?</p>

<p>Thanks</p>
