asp.net - stream pdf from MemoryStream -
i'm streaming pdf .ashx file browser using following code:
context.response.clear(); context.response.charset = ""; context.response.contenttype = "application/pdf"; context.response.addheader("content-disposition", "inline;filename=test.pdf"); context.response.addheader("content-length", stream.length.tostring()); stream.writeto(context.response.outputstream); context.response.flush(); context.response.end();
where context comes from:
public void processrequest(httpcontext context)
all works when using chrome or firefox , displays on browser. when use ie 11 blank screen. if go adobe reader->edit->preference->internet , uncheck "display pdf in browser" ie opens adobe reader , shows pdf properly. unchecked "display pdf in browser" shows blank screen:
if go ie "manage add-ons" shows adobe enabled:
i've seen other post nothing seems work. i'm thinking ie thing since chrome , firefox works , ie displays if don't have load on browser.
any ideas on causing this?
update: fiddler data:
here got fiddler. nothing stands out between chrome , ie except ie doesnt work:
chrome: request:
get /filedownloadhandler.ashx?session=agenda_item_number_download&id=6079&downloadtoken=635685165181990000 http/1.1 host: localhost connection: keep-alive accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8 user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/43.0.2357.81 safari/537.36 referer: http://localhost/filedownload.aspx?session=agenda_item_number_download&id=6079 accept-encoding: gzip, deflate, sdch accept-language: en-us,en;q=0.8,es;q=0.6,ru;q=0.4 cookie: asp.net_sessionid=n3r0p3lgrnsherwl0iid3ser
response:
http/1.1 200 ok cache-control: private content-length: 150173 content-type: application/pdf server: microsoft-iis/8.0 content-disposition: inline;filename=test.pdf x-aspnet-version: 4.0.30319 set-cookie: downloadsessiontoken=635685165181990000; path=/ x-sourcefiles: =?utf-8?b?qzpcuhjvamvjdhnctunxzwjbchbsawnhdglvbnncu291cmnlxe1vagf2zunvdw50evxgawxlrg93bmxvywriyw5kbgvylmfzahg=?= x-powered-by: asp.net date: fri, 29 may 2015 17:15:19 gmt
ie:
request:
get /filedownloadhandler.ashx?session=agenda_item_number_download&id=6079&downloadtoken=635685164869660000 http/1.1 accept: text/html, application/xhtml+xml, / referer: http://localhost/filedownload.aspx?session=agenda_item_number_download&id=6079 accept-language: en-us user-agent: mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; rv:11.0) gecko accept-encoding: gzip, deflate connection: keep-alive dnt: 1 host: localhost pragma: no-cache cookie: asp.net_sessionid=1ekxziruzsstknjubyugl3ur
response:
http/1.1 200 ok cache-control: private content-length: 150173 content-type: application/pdf server: microsoft-iis/8.0 content-disposition: inline;filename=test.pdf x-aspnet-version: 4.0.30319 set-cookie: downloadsessiontoken=635685164869660000; path=/ x-sourcefiles: =?utf-8?b?qzpcuhjvamvjdhnctunxzwjbchbsawnhdglvbnncu291cmnlxe1vagf2zunvdw50evxgawxlrg93bmxvywriyw5kbgvylmfzahg=?= x-powered-by: asp.net date: fri, 29 may 2015 17:14:47 gmt
fix update
ok seems adobe reader problem. found problem because stream produce 103:103 error. after doing searches found says following:
launch adobe reader in "adobe preferences" open menu "general" untick (uncheck) setting "enable protected mode @ startup" if doesn't uninstall software, run adobe cleaner tool , reinstall software.
and working properly. ive included cc tool in case wants use it.
i posted answer in original post. seems issue adobe reader bug.
Comments
Post a Comment