Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-10-28
4
Medium Priority
?
318 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

636 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