403 error when opening PDF with chrome pdf viewer -
we host c# 3.5 net web app in iss 7.5.
pdf files generated , put in directory. listing of directory disabled. browsers (ie10, ff, opera...) can access pdf.
when accessing url chrome, pdf loaded... 403 error. if disable chrome internal pdf viewer , tell use adobe's, works fine.
what can wrong?
problem explained here: http://productforums.google.com/forum/#!topic/chrome/1msjcjabwpe
but mentioned kb cannot applied we'll httphandler
.
public void processrequest(httpcontext context) { switch (context.request.httpmethod) { case "get": if (!context.user.identity.isauthenticated) { formsauthentication.redirecttologinpage(); return; } string requestedfile = context.server.mappath(context.request.filepath); context.response.contenttype = "application/pdf"; context.response.transmitfile(context.server.mappath(context.request.filepath)); context.response.end(); break; } }
Comments
Post a Comment