asp.net - Adobe PDF not showing on IIS7 -


i got code below working on local (using source code) fine. when published on iis7 pdf not showing anymore.. there problem iis or ?. . . spent many days on problem.

dim strpath = server.mappath("~\reports\generatedreport.pdf")  my_rpt.exporttodisk(exportformattype.portabledocformat, strpath) dim file = new system.io.fileinfo(strpath) dim process = new process() if file.exists     process.startinfo.useshellexecute = true     process.startinfo.filename = strpath     process.start() else     'no report found end if 

as can notice in picture below see adobereader running not displaying on screen.

enter image description here

when "not showing" assuming want pdf opened on client, not server. send file browser. process.start() start process server-side, if apppool allowed start process, open pdf on server. below how send file server client.

string strpath = server.mappath("~/reports/generatedreport.pdf");  //read file disk , convert byte array byte[] bin = file.readallbytes(strpath);  //clear buffer stream response.clearheaders(); response.clear(); response.buffer = true;  //set correct contenttype response.contenttype = "application/pdf";  //set correct length of data being send response.addheader("content-length", bin.length.tostring());  //set filename file response.addheader("content-disposition", "attachment; filename=\"generatedreport.pdf\"");  //send byte array browser response.outputstream.write(bin, 0, bin.length);  //cleanup response.flush(); httpcontext.current.applicationinstance.completerequest(); 

vb

dim strpath string = server.mappath("~/reports/generatedreport.pdf")  'read file disk , convert byte array dim bin() byte = file.readallbytes(strpath)  'clear buffer stream response.clearheaders response.clear response.buffer = true  'set correct contenttype response.contenttype = "application/pdf"  'set correct length of data being send response.addheader("content-length", bin.length.tostring)  'set filename file response.addheader("content-disposition", "attachment; filename=""generatedreport.pdf"""")", send byte array browser, response.outputstream.write(bin, 0, bin.length))  'cleanup response.flush httpcontext.current.applicationinstance.completerequest 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -