Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Some HTML code in Textfile downloaded.

Some HTML code in Textfile downloaded.

Scheduled Pinned Locked Moved ASP.NET
csharphelpquestionhtmlsysadmin
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Junior Boy
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • J 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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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 )

      J 1 Reply Last reply
      0
      • C Christian Graus

        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 )

        J Offline
        J Offline
        Junior Boy
        wrote on last edited by
        #3

        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

        J 1 Reply Last reply
        0
        • J 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

          J Offline
          J Offline
          Junior Boy
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups