473,701 Members | 2,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateTe xt();
MemoryStream renderedPage = new MemoryStream(10 240);
Html32TextWrite r myWriter = new Html32TextWrite r(new
StreamWriter(re nderedPage, System.Text.Enc oding.UTF8));

this.Render(myW riter);
//Breakpoint I'm pointing at
renderedPage.Po sition = 0;
using (StreamReader sr = new StreamReader(re nderedPage))
{
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="#FFFFF F" align="center"> 2</td>
<td bgcolor="#FFFFF F">ABCDEFG</td>
<td bgcolor="#FFFFF F" align="center"> 2</td>
<td bgcolor="#FFFFF F">100</td>
<td bgcolor="#FFFFF F">200</td>
</tr>
<tr>
<td bgcolor="#FFFFF F" align="center"> 3</td>
<td bgcolor="#FFFFF F">HIJKLMN</td>
<td bgcolor="#FFFFF F" 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.Le ngth" 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 Html32TextWrite r.

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 2038
Some information to add:

I've found that if I attach the "StreamWrit er connected to the filestream"
to the Html32TextWrite r 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.Bod y 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
1439
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 left and a main 'viewer' to the right of this. When the user clicks on a record the details are loaded into the main area. When the user clicks on a certain record that has a PDF attachment they can chose to view that PDF in the main viewer...
1
2169
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 being called by the asp.net enginge ??? To be more specific, the thing I currently am most interested in understanding is from which method in the Page class you can know that that the Render method of all aggregated controls have been called...
4
1687
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, Alejandro Penate-Diaz.
7
2145
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 fine, however what I would like to do is sent the entire contents of the posted back page as a HTML email. Is this possible and if so could somebody point me in the right direction to achieving this.
4
1423
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 standard OnError virtual method to handle this requirement because the form does not complete its rendering process when this occurs. I really need the form to display properly on the screen. I have managed to catch nearly all exceptions by...
2
1035
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 the page (e.g. which rely on longer retrieval from a database). How would I go about doing this? We're using ASP.net 1.1.. Many thanks for any help or advise. Andy
10
2932
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 users! i've looked around online and can find nothing to do this, or in the SDK docs. i thought .Net 2.0 would have something more out-of-the-box for this type of performance measuring but i can't find any. i was thinking about running a timer...
14
23160
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, we're looking for a way to display the page with a "please wait..." message while the process is running, and then, when the process is done, update the page with the actual results/page content. We have a page that opens another browser/page...
4
2144
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 IE 7 and IE 6 behave the same way - they fail to render the page at all yet do not seem to be detecting any errors on the client side. No errors occur on the web server either. I've issued VIEW SOURCE on this blank IE screen and captured it to a...
0
8736
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8649
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9229
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9083
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8934
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6571
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4410
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3102
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.