Solved

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

Posted on 2013-10-28
4
307 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
  • 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

867 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now