473,387 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Page.Render do not render complete page

Hello,

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.UTF8));

this.Render(myWriter);
//Breakpoint I'm pointing at
renderedPage.Position = 0;
using (StreamReader sr = new StreamReader(renderedPage))
{
MyWriter.Write(sr.ReadToEnd());
sr.Close();
MyWriter.Close();
}
[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" >
<HTML>
<HEAD>
.......
<tr>
<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>
</tr>
<tr>
<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.

Regards,
Lau Lei Cheong
Nov 18 '05 #1
1 2030
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.

Regards,
Lau Lei Cheong
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: NeilG | last post by:
Hi, I have an ASPX page with a literal control on the page. The page structure is like a frameset (but I dont use frames, this is just to give you an idea of how it looks) with records down the...
1
by: Tomas | last post by:
Is there any sequence diagram on the web that clearly shows in which order all Page methods (load, render and so on) are being called compared to the order the page's contained control methods are...
4
by: Alex | last post by:
Hi. I need to insert an entire html page from a string variable into a asp.net page. I thought that literals should work, but still I need to remove some tags like html, body, etc. Thanks, ...
7
by: Martin | last post by:
Hi, I have a standard aspx page (form) that contains a few user controls. Upon form submission the page is validated. If validation passses then a text based email is sent. This is all working...
4
by: Tony | last post by:
I am in the process of setting up a base page model for multiple reasons. One of the reasons is so that I can catch all exceptions when derived pages throw/raise them. I don't want to use the...
2
by: Andy | last post by:
Hi, We have a few rather heavy pages and would like to speed up the 'perceived' download time by rendering some sections of the page which are ready to be shown while sill awaiting other parts of...
10
by: Tim_Mac | last post by:
hi, i would like to display a discreet message on all my pages indicating how long the server took to render the page. full tracing is not an option because it would freak out my non-technical...
14
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So,...
4
by: JJA | last post by:
Previously, anything IE did not like threw some sort of error like "object expected", etc. Now all I get is "Done" on the status bar... I am suddenly having trouble with Internet Explorer. Both...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.