Solved

Response.Write is not completing output

Posted on 2014-03-25
2
238 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
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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…
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

758 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

21 Experts available now in Live!

Get 1:1 Help Now