Solved

Response.Write is not completing output

Posted on 2014-03-25
2
245 Views
Last Modified: 2014-04-10
hi
I have code that creates XML file when user clicks on button. I find that the end of the string is being omitted though. Please advise on this.
It works on windows 2003 but not 2012. The error came around when moving from 2003 to 2012.

       
Public Shared Sub saveToHardDrive(filename As String,
                                          Response As HttpResponse, _
                                          textToWriteToFile As String,
                                          fileExtension As String)
                'response to prompt user to save.
                Response.ClearContent()
                Response.ContentType = "text/plain"

                'replace spaces with %20, prevents IE replacing with _ underscores
                If HttpContext.Current.Request.UserAgent.Contains("MSIE 7.0") Then
                    filename = filename.Replace(" ", "%20")
                End If

                'add XML to filename
                If Not filename.EndsWith(fileExtension) Then
                    filename += fileExtension
                End If
                Response.AddHeader("Content-disposition", "attachment;filename=""" + filename + """")

                Response.Write(textToWriteToFile)


                Response.BufferOutput = True
                Response.Flush()
                Response.Close()
        End Sub

Open in new window

0
Comment
Question by:rwallacej
[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
2 Comments
 
LVL 9

Accepted Solution

by:
BlueYonder earned 500 total points
ID: 39953100
Check the version of .net framework in use on 2003 then make sure the version is installed on the 2012 server.  Also make sure the target framework is set as shown in http://msdn.microsoft.com/en-us/library/bb772098(v=vs.90).aspx.  The problem may be with framework 4.5 and new namespaces.
0
 

Author Closing Comment

by:rwallacej
ID: 39992153
probably is this, to be checked - ended up moving back to old server though
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 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