Response.WriteBinary problem.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave

    Response.WriteBinary problem.

    I've been working on a small page that allows my users to publish and
    retrieve documents from a SQL database. Everything appears to be
    working fine with exception of 2 things.

    1.) Any file that can be opened and edited with the NotePad, once the
    file has been uploaded to the SQL Server, when it's retrieved it has
    the HTML for the web page I'm retrieving the file with. Below is an
    example of a text file that I uploaded.

    File Content Example:

    This lline was entered in the *.txt file before uploading. Everything
    below this was added when retrieving from SQL.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
    www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>
    Untitled Page
    </title>
    <link href="App_Theme s/j....

    End Example



    2.) Office 2007 format documents retrieve as being corrupt.



    Is Response.WriteB inary the proper way to do this...and if so, can you
    give me some insite as to where I might be able to fix this problem?

    Any help would be greatly appreciated.
  • Joern Schou-Rode

    #2
    Re: Response.WriteB inary problem.

    On Mon, 27 Oct 2008 13:39:25 +0100, Dave <Dave.Burkett@j acobs.comwrote:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
    www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    From where are you making the call to the HttpResponse.Wr iteBinary method?

    If you make the call from the code-behind of an ASPX-page (so it seems),
    you might need to place the call between a Response.Clear( ) and a
    Response.End(), to be sure that no markup is added to your output.

    Example:

    Response.Clear( );
    Response.WriteB inary(data);
    Response.End();

    --
    Joern Schou-Rode

    Comment

    • =?ISO-8859-1?Q?G=F6ran_Andersson?=

      #3
      Re: Response.WriteB inary problem.

      Already replied in your other thread in the same newsgroup.

      --
      Göran Andersson
      _____
      Göran Anderssons privata hemsida.

      Comment

      Working...