Click here to Skip to main content
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 20:25pm
Edited 28-Sep-10 21: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 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 Afzaal Ahmad Zeeshan 170
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 19 Apr 2013
Copyright © CodeProject, 1999-2014
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