My problem is that I send to client first PDF to download, then I need to check, if some data exists in my database, then depending on that check I need to show question tha
@Darin is a great help always on this forum. His response saved my day too. Just extending his answer to include the formats and stuff that I did. This is in response to his " Now if the controller action uses the Content-Disposition header to attachment it will offer the user to download the file:"
case "PDF":
HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + reportName + ".pdf");
break;
case "XML": HttpContext.Current.Response.AddHeader("Content-Type", "application/xml");
break;
case "MHTML": HttpContext.Current.Response.AddHeader("Content-Type", "message/rfc822");
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + reportName + ".mhtml");
break;
case "EXCEL": HttpContext.Current.Response.AddHeader("Content-Type", "application/vnd.ms-excel");
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + reportName + ".xls");
break;
case "WORD": HttpContext.Current.Response.AddHeader("Content-Type", "application/msword");
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + reportName + ".doc");
break;
case "CSV":
HttpContext.Current.Response.AddHeader("Content-Type", "text/csv");
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + reportName + ".csv");
break;
case "HTML4.0": HttpContext.Current.Response.AddHeader("Content-Type", "message/rfc822"); ;
break;