Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Response.Write is not completing output

Posted on 2014-03-25
2
Medium Priority
?
250 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 2000 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

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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 brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
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…

721 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