Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Response.WriteBinary problem.

Reply
Thread Tools

Response.WriteBinary problem.

 
 
Dave
Guest
Posts: n/a
 
      10-27-2008
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.dtd">

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

End Example



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



Is Response.WriteBinary 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.
 
Reply With Quote
 
 
 
 
Joern Schou-Rode
Guest
Posts: n/a
 
      10-27-2008
On Mon, 27 Oct 2008 13:39:25 +0100, Dave <(E-Mail Removed)> wrote:

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


From where are you making the call to the HttpResponse.WriteBinary 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.WriteBinary(data);
Response.End();

--
Joern Schou-Rode
http://malamute.dk/
 
Reply With Quote
 
 
 
 
Göran Andersson
Guest
Posts: n/a
 
      10-27-2008
Already replied in your other thread in the same newsgroup.

--
Göran Andersson
_____
http://www.guffa.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments