Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
I hope someone can help me with this. I am trying to open a pdf file in my asp.net application using c#. When I run it on my PC with Visual Studio, it works fine. When I try to run it on the server the pdf file is not opening.
here is the code below:
this code is written in button click.
Response.Write("<script>window.open('Pdfgenerator.aspx?id=" + txtPatientid.Text + "&fi=" + caseid + "_BillReport" + ".pdf ','_blank')</script>");
This code is written in
Pdfgenerator.aspx
where the pdf should be open.
string id = Request.QueryString["id"].ToString();
        string cs = Request.QueryString["fi"].ToString();
        Response.Clear();
        Response.ContentType = "Application/PDF";
        Response.WriteFile("pdfs/" + id + "/"+id+"_"+cs);
        Response.Flush();
        Response.Close();
thanks
parithi
Posted 26-Dec-12 23:01pm
Edited 27-Dec-12 0:29am
v2
Comments
Zoltán Zörgő at 27-Dec-12 5:33am
   
And what happens if you open in the browser manually the url to the Pdfgenerator.aspx (complete with parameters) manually?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

try below Links
Hope This will Help you..
Link 1[^]
Link 2[^]
Link 3[^]
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 480
1 Bhavik_Patel 190
2 Richard MacCutchan 155
3 PhilLenoir 155
4 Gihan Liyanage 155
0 Sergey Alexandrovich Kryukov 8,688
1 OriginalGriff 7,237
2 CPallini 2,598
3 Richard MacCutchan 2,080
4 Abhinav S 1,888


Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 27 Dec 2012
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