Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Page.Render do not render complete page

Thread Tools

Page.Render do not render complete page

Lau Lei Cheong
Posts: n/a

I'm writing a web page using ASP.NET that with send the page's HTML
content to user through e-mail. My plan is to dump the content to a file
then email it to user as attachment.

The following the part of the code I used:
[Begin of Quote]
StreamWriter MyWriter = myfile.CreateText();
MemoryStream renderedPage = new MemoryStream(10240);
Html32TextWriter myWriter = new Html32TextWriter(new
StreamWriter(renderedPage, System.Text.Encoding.UTF);

//Breakpoint I'm pointing at
renderedPage.Position = 0;
using (StreamReader sr = new StreamReader(renderedPage))
[End of Quote]

And the following is the fragment where the saved page on server stop at:

[Begin of Quote]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<td bgcolor="#FFFFFF" align="center">2</td>
<td bgcolor="#FFFFFF">ABCDEFG</td>
<td bgcolor="#FFFFFF" align="center">2</td>
<td bgcolor="#FFFFFF">100</td>
<td bgcolor="#FFFFFF">200</td>
<td bgcolor="#FFFFFF" align="center">3</td>
<td bgcolor="#FFFFFF">HIJKLMN</td>
<td bgcolor="#FFFFFF" align="center">1</td>
[End of Quote]

The problem is, whatever the code is called in Page_Load or Page_Unload
event, the HtmlWriter seems to stop writing somewhere less than 4400bytes,
where the actual HTML length should be 4937 bytes. I measures this at the
breakpoint stated in the enclosed code, by typing "? renderedPage.Length" in
the command window.

I've tried to increase the memory allocated to program, use byte[] to
replace MemoryStream, using RenderControl instead of Render, etc. but with
no luck.
It seems to be the problem with Html32TextWriter.

It's quite strange to me the place where it stopped because it's in the
middle of a group of rows generated from the code on-the-fly. And the page
shown on the browser rendered completely without problem.

Does anyone have idea on why does it happen, or how to work around it? Any
help would be appreciated.

Thank you in advance.

Lau Lei Cheong

Reply With Quote
Lau Lei Cheong
Posts: n/a
Some information to add:

I've found that if I attach the "StreamWriter connected to the filestream"
to the Html32TextWriter directly, then everything is Ok. So the problem
should be on the MemoryStream.

It's pity to find that because in my plan, the next thing to do is to try to
write the content directly to the MailMessage.Body and send as HTML.

Any help to workaround this would be appreciated.

Lau Lei Cheong

Reply With Quote

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy Question ;-) How to render a html page in a table cell of an ASP.NET page SteveM ASP .Net 7 12-14-2006 08:10 PM
Accessing rails render method outside of view / Decorating render Glenn Gillen Ruby 0 11-17-2006 02:30 PM
Firefox does not render .asp page Shiva SG ASP .Net 1 02-14-2006 12:31 PM
Mr. Bean Complete Bean NOT complete!! Waterperson77 DVD Video 5 12-10-2003 05:22 PM
Slow Compile doesn't render complete page. Lewis Edward Moten III ASP .Net 2 10-25-2003 03:00 AM