-1

I have two web applications that perform the same task: generating an XML file. The XML nodes are mixed case and case sensitive. The apps run in different environments and can't be moved.

I'm using Content-Disposition to send the XML string as a file download.

Web app A (C#.NET 3.5) works correctly.

Web app B (C#.NET 2.0) changes the XML nodes to all lower case at the time of download. I've stepped through the code and verified that the XML string is mixed case right up until the response is sent.

I've checked the response headers from the two servers. They are a bit different, but I don't see what would cause this behavior.

A (works):

Cache-Control:private
CacheControl:no-cache, no-store, must-revalidate
Connection:Close
Content-Disposition:attachment; filename=license.xml
Content-Length:1137
Content-Type:text/xml; charset=utf-8
Date:Mon, 28 Dec 2015 20:12:23 GMT
Expires:Thu, 01 Dec 1994 16:00:00 GMT
Pragma:no-cache
Server:ASP.NET Development Server/9.0.0.0
X-AspNet-Version:2.0.50727

B (fails):

Cache-Control:private
Content-Disposition:attachment; filename=license.xml
Content-Length:1137
Content-Type:text/xml; charset=utf-8
Date:Mon, 28 Dec 2015 20:11:25 GMT
Server:Microsoft-IIS/5.1
X-AspNet-Version:2.0.50727
X-Powered-By:ASP.NET

It's the same code on both apps. I can't find anything to explain this! HELP!!

string someXML = "<MyXML><SomeNode>Hello World</SomeNode></MyXML>";
Response.ContentType = "text/xml";
Response.AddHeader( "Content-Disposition", "attachment; filename=myfile.xml" );
Response.Write( someXML );
Response.End();

Results in an XML file with this content:

<myxml><somenode>Hello World</somenode></myxml>

[UPDATE:] I removed the Content-Disposition, instead just spitting out the XML to the browser. The .NET 2.0 STILL results in all lowercase tags. So, it seems it comes down to the actually response from .NET 2.0.

[UPDATE:] I created a new .NET 2.0 web app to test this. The new app correctly sends mixed-case XML. There must be some setting in App B that is causing this, but I haven't found it yet.

Trint
  • 19
  • 3

1 Answers1

0

Check the raw response. Perhaps they come back with different values for Content-Type?

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98
  • It may have to do with the encoding. Try UTF8. I would use a sniffer like fiddler or Wireshark and look at the HTTP headers and compare the Net2.0 with the Net3.5. I suspect therre is differences in the default headers. – jdweng Dec 28 '15 at 18:51