Solved

Sporadic inability to download pdf after upgrade to Asp.Net 4.0 of SSL website

Posted on 2013-10-28
4
313 Views
Last Modified: 2013-12-11
Yesterday we upgraded our SSL website from asp.net 2.0 to asp.net 4.0. Today some clients using IE8 are saying they are having sporadic problems downloading pdf files. They get an error saying something about downloading the aspx page (not the pdf file).  They did note that if they access the site using http instead of https, they do not have an issue.  
To do the upgrade, we did testing of "our_site" using a folder called "our_site4.0".  When we made the switch, we renamed "our_site" to "our_site2.0" and "our_site4.0" to "our_site".  So there is a new folder involved, but all of the folder security setting and user access settings are identical.

Here is the aspx code that outputs the pdf, and it has not changed between 2.0 and 4.0.

 Response.ContentType = "application/pdf"
        Response.AddHeader("content-disposition", "inline; filename=FormPacket.PDF")
        Response.AddHeader("content-length", theData.Length.ToString())
        Response.BinaryWrite(theData)
        Response.End()
        Response.Clear()
        Response.Close()

 I read some articles that talk about issues with no-cache, but we are not using that setting in the code.  Does anyone have any ideas what the issue is? Thank you.
0
Comment
Question by:tigriswoods
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:tigriswoods
ID: 39607312
Sorry, just to emphasize the point - the same clients were able to download the pdf files the day before yesterday. No issues then with the asp.net 2.0 site - just the new 4.0 site.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39608804
Do you have the exact error message that the client are getting?
0
 

Accepted Solution

by:
tigriswoods earned 0 total points
ID: 39701731
Sorry for the delay. We had to solve the problem that night, which we did, then I was out for two weeks.  The experts asked me to address this abandoned question.  Here is the solution:

THE BROKEN CODE

Dim filename As String = "ExportData.csv"
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition  attachment; FileName=" & filename)
Response.Flush()
Response.Write(Regex.Replace(sw.ToString(), "(<a[^>]*>)|(</a>)", " ", RegexOptions.IgnoreCase))
Response.End()


  ********* The WORKING CODE **********
Dim filename As String = "ExportData.csv"
Response.Clear()
'BEGIN NEW CODE
Response.Buffer = True
Response.ClearContent()
Response.ClearHeaders()
Response.AddHeader("Cache-Control", "max-age=3")
Response.AddHeader("Pragma", "public")
'END NEW CODE

Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition  attachment; FileName=" & filename)
Response.Flush()
Response.Write(Regex.Replace(sw.ToString(), "(<a[^>]*>)|(</a>)", " ", RegexOptions.IgnoreCase))
Response.End()
0
 

Author Closing Comment

by:tigriswoods
ID: 39710850
This solution fixed the problem.
0

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question