Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8099375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:23:33+00:00 2026-06-05T22:23:33+00:00

I’m trying to identify if this is an IIS issue or a code issue.

  • 0

I’m trying to identify if this is an IIS issue or a code issue. I’m leaning toward the former, but in that case I’m not sure how to fix it.

I have several Asp.Net web applications that create PDFs as a MemoryStream (using iTextSharp) and then use the MemoryStream.ToArray method to display the PDF on screen. Below is the basic code I use.

Try 
    Dim m As System.IO.MemoryStream = pdfhelper.createFileMethod(filename)
    Dim data As Byte() = m.ToArray  
    Response.Clear()
    Response.Buffer = True
    Response.AddHeader("Content-Length", data.Length.ToString())
    Response.AddHeader("Content-Disposition", "inline; filename=sample")
    Response.AddHeader("Expires", "0")
    Response.AddHeader("Pragma", "cache")
    Response.AddHeader("Cache-Control", "private")
    Response.ContentType = "application/pdf"
    Response.AddHeader("Accept-Ranges", "bytes")
    Response.BinaryWrite(data)
    Response.Flush()
    Response.End()
Catch ex As Exception
    throw ex
End Try

I am serving from Windows Server 2008 R2 Standard Edition, 64 bit, version 6.1 Build 7601 Service Pack 1 with IIS 7.5.7600.16385.

When I use the application in Internet Explorer, I have no trouble opening the PDF documents. When I use Chrome or Firefox, the PDF just hangs while loading. It simply will not load. I do not get an error message. The problem is the same whether I run on the server or on the client.

However, when I run on my development box using the IIS built into Visual Studio, I have no problem regardless of browser.

I am aware of the issue addressed in this hotfix. I thus assumed the problem is in IIS. However, I cannot apply the hotfix because it is only valid for the Build 7600 of my version of Windows.

So am back to wondering – is this IIS? Is this my code and it’s just that IE is more forgiving of an error I am making? And how do I fix it?

Thanks for any ideas you can give.

Edit: I found this suggestion, which forces PDFs to be downloaded instead of opened in the browser. Definitely NOT the ideal solution for this problem. Hoping someone has another idea.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:23:36+00:00Added an answer on June 5, 2026 at 10:23 pm

    I finally resolved this, although I don’t have a 100% “why” for it.

    1) I changed my code behind to the following, removing the commands to wait for the buffer and then end response.

        Response.ClearContent()
        Response.ClearHeaders()
        Response.ContentType = "application/pdf" 
        Response.AppendHeader("Content-Length", data.Length.ToString())
        Response.AppendHeader("Content-Disposition", "inline; filename=" + "Sample.pdf")
        Response.AppendHeader("Accept-Ranges", "bytes")
        Response.BinaryWrite(data)
    

    2) updated the aspx page for which this is the code behind. It still had all the html “stuff”. I removed everything on the page except for the Page Directive command.

    At this point, the PDFs continues to work with IE. On some people’s computers with older (9.x) Adobe plug-ins, Firefox views in the browser with no difficulty. On a computer which has the Adobe 10.1.3, Firefox prompts with the “open or save” dialog. But Chrome (v. 19.0.1084.56) still hangs.

    3) After testing with Safari on an IPad and having no issues, I decided it was a Chrome issue. I disabled the Chrome Adobe plug-in and now the PDF displays in the browser as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.