Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
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.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

805 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