Solved

Response.Write is not completing output

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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