Solved

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

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How configure a site in IIS 8 to redirect to an specific URL 3 35
IIS 7 Log 2 19
DLL in ASP.NET 20 40
Problem to page 4 17
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

17 Experts available now in Live!

Get 1:1 Help Now