Some HTML code in Textfile downloaded.
-
I have no idea how can i get the HTML code in the textfile that I downloaded from the server. Here is the code... (C# .net) ============================================================================================ String filename = "dataFile.txt"; String fileDownload = Server.MapPath("TextFiles//mydata.txt"); Response.ContentType = "text/plain"; String disHeader = "Attachment; Filename=\"" + filename + "\""; Response.AppendHeader("Content-Disposition", disHeader); FileInfo fileToDownload = new FileInfo(fileDownload); Response.WriteFile("" + fileToDownload.FullName); ============================================================================================ I tried to used the vb .net it has no problem I mean no HTML code in the textfile. Anybody who has ever had this problem? or Anybody who know this how to solve the problem help me please. Thank you very much.
junior boy
-
I have no idea how can i get the HTML code in the textfile that I downloaded from the server. Here is the code... (C# .net) ============================================================================================ String filename = "dataFile.txt"; String fileDownload = Server.MapPath("TextFiles//mydata.txt"); Response.ContentType = "text/plain"; String disHeader = "Attachment; Filename=\"" + filename + "\""; Response.AppendHeader("Content-Disposition", disHeader); FileInfo fileToDownload = new FileInfo(fileDownload); Response.WriteFile("" + fileToDownload.FullName); ============================================================================================ I tried to used the vb .net it has no problem I mean no HTML code in the textfile. Anybody who has ever had this problem? or Anybody who know this how to solve the problem help me please. Thank you very much.
junior boy
Almost certainly you have debug tracing turned on, so it gets rendered below your text. Response.Flush() and Response.End() should stop it, but also turn tracing off in the aspx that creates the text file.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Almost certainly you have debug tracing turned on, so it gets rendered below your text. Response.Flush() and Response.End() should stop it, but also turn tracing off in the aspx that creates the text file.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Well, I did turn it off. please see my code.. <%@ Page language="c#" CodeFile="test.aspx.cs" Trace="false"%> is this correct? If so it didn't work. I still got HTML code in the Text file. Thank you million.
junior boy
-
Well, I did turn it off. please see my code.. <%@ Page language="c#" CodeFile="test.aspx.cs" Trace="false"%> is this correct? If so it didn't work. I still got HTML code in the Text file. Thank you million.
junior boy
Oh...Gosh.. Thank you very much for your help. I am really appreciated. Now I got it work. I chaged some code it's Response.Flush() to Response.End() I think .Flush() it doesn't work for this somehow. Thank you very much..I spent all two days for this :(
junior boy