file download via Response.BinaryWrite shows HTML tags

Discussion in 'ASP .Net' started by MichiMichi, Mar 1, 2007.

  1. MichiMichi

    MichiMichi Guest

    I am trying to secure filedownload via streaming to protect files on
    the server. This works very well but when I open the file in a notepad
    editor it shows always HTML code at the end of the file.

    Since the code runs in a aspx file, the added HTML Code always
    streamed at the end.

    What do I have to do so the files are stored without the HTML tags on
    the client machine?



    Here is the code:


    ..............
    Response.Clear()
    Response.ClearContent()
    Response.ClearHeaders()
    Response.AppendHeader("content-disposition", "attachment;
    filename=" & strFilename)

    Response.ContentType = strContentType
    Response.BufferOutput = True

    Response.BinaryWrite(bytFile)
    ..........
     
    MichiMichi, Mar 1, 2007
    #1
    1. Advertisements

  2. MichiMichi

    MichiMichi Guest

    Got if...forgot to write "Response.end" right after
    Response.BinaryWrite(bytFile)
     
    MichiMichi, Mar 1, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.