Click here to Skip to main content
11,708,116 members (71,620 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Response.ContentType = "Application/whoispp-response" 
            Response.AddHeader("Content-disposition", "inline;filename=Reportname.pdf")
 
 Response.BinaryWrite(bytes)
            Response.Flush()


It is open pdf in acrobat without asking open dialog box,
but one problem arise ,that is the viewer page is shown as empty , I want to show another page , how it is possible?
Posted 28-Sep-10 19:25pm
Edited 28-Sep-10 20:01pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Try Response.TransmitFile() to explicitly send the file from your ASP.NET application. This will cause a Open / Save As dialog box to pop up with the filename.

Visit this [Downloading a File with a Save As Dialog in ASP.NET] for more info.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

did you tried window.open() method...
  Permalink  
Comments
usankardurai at 29-Sep-10 4:52am
   
window.open() menthod need path for the file , but i didnt strore anywhere it.then , can u tell me , how to download pdf file without ask save dialog box ?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

If you want to open pdf File in new Tab with clicking hyperlink follow this
1: Add one form as PDFViewer.aspx.
2: on the Page_Load event of this form add following code.

protected void Page_Load(object sender, EventArgs e)
   {
       if (!IsPostBack)
       {
           Response.ClearHeaders();
           Response.ClearContent();
           Response.Redirect("nameofPDFFile.pdf");
       }
   }

3. set properties of hyperlink is follows:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/PDFViewer.aspx"
            Target="_blank">HyperLink</asp:HyperLink>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Hi,

Try this,

Using System.Net.WebClient

It Will Show Particular Page with the Content Of Pdf File
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
      string path = Server.MapPath("Doc\demo.pdf");
      WebClient client = new WebClient();
      Byte[] buffer = client.DownloadData(path);
 

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

Thanks

Siva Rm K
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 230
1 Mika Wendelius 180
2 OriginalGriff 168
3 Sergey Alexandrovich Kryukov 145
4 Peter Leow 140
0 OriginalGriff 9,198
1 Sergey Alexandrovich Kryukov 8,562
2 CPallini 5,189
3 Maciej Los 4,921
4 Mika Wendelius 3,856


Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 19 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100