473,320 Members | 1,856 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,320 software developers and data experts.

send mail with page-html-content

I have a page with the following code for example:

<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1"
Debug="true"%>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
texttoview.Text = "this is the text";
}
</script>

<!--#include virtual="/templates/Head.aspx" -->
<title>Title of the page</title>
</head>
<body>
<form runat="server">
<asp:Label runat="server" ID="texttoview" />
</form>
<!--#include virtual="/templates/Footer.aspx" -->

After this page is "generated", or better said the html-code of this page, I
want to send this html-code by email to someone.
How can i make this possible? On this page could be a button, which causes
the sending-process on click.

thank you for your help.
Nov 19 '05 #1
4 2460
Alexander:
Check out: http://www.openmymind.net/FAQ.aspx?documentId=45

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:O$*************@TK2MSFTNGP15.phx.gbl...
I have a page with the following code for example:

<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" Debug="true"%>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
texttoview.Text = "this is the text";
}
</script>

<!--#include virtual="/templates/Head.aspx" -->
<title>Title of the page</title>
</head>
<body>
<form runat="server">
<asp:Label runat="server" ID="texttoview" />
</form>
<!--#include virtual="/templates/Footer.aspx" -->

After this page is "generated", or better said the html-code of this page, I want to send this html-code by email to someone.
How can i make this possible? On this page could be a button, which causes
the sending-process on click.

thank you for your help.

Nov 19 '05 #2
if I follow the manual on http://www.openmymind.net/FAQ.aspx?documentId=45 i
have a problem ... i "converted" it to C# and now it looks like this:

StringBuilder stringBuilder = new StringBuilder();
StringWriter stringWriter;
HtmlTextWriter htmlTextWriter;
try
{
stringWriter = new StringWriter(stringBuilder);
htmlTextWriter = new HtmlTextWriter(stringWriter);
user.RenderControl(htmlTextWriter);
}
finally
{
stringWriter.Close();
htmlTextWriter.Close();
}
Now there was the error at "user.RenderControl(htmlTextWriter);" or even
with "user" with capital u at the beginning.... the method is unknown...
so I changed "user" to "page" ... but now there is this error-message:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
.....
[HttpException (0x80004005): A page can have only one server-side Form tag.]

But there is only one form-tag .... I think it's wrong that i chose "page"
..... what is the right?

I dont know what to do....

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schrieb im Newsbeitrag news:uH**************@TK2MSFTNGP10.phx.gbl...
Alexander:
Check out: http://www.openmymind.net/FAQ.aspx?documentId=45

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:O$*************@TK2MSFTNGP15.phx.gbl...
I have a page with the following code for example:

<%@ Page Language="C#" ContentType="text/html"

ResponseEncoding="iso-8859-1"
Debug="true"%>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
texttoview.Text = "this is the text";
}
</script>

<!--#include virtual="/templates/Head.aspx" -->
<title>Title of the page</title>
</head>
<body>
<form runat="server">
<asp:Label runat="server" ID="texttoview" />
</form>
<!--#include virtual="/templates/Footer.aspx" -->

After this page is "generated", or better said the html-code of this
page,

I
want to send this html-code by email to someone.
How can i make this possible? On this page could be a button, which
causes
the sending-process on click.

thank you for your help.


Nov 19 '05 #3
I'll clean up the FAQ, it isn't very clear....

user was a user control, so you would do:

SomeControl someControl = Page.LoadControl("someControl.ascx")

and then do:

someControl.RenderControl(htmlTextWriter);
This is easier done on a UserControl than a Page, so i would suggest you
simply move the page's stuff into a user control.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:u3**************@TK2MSFTNGP15.phx.gbl...
if I follow the manual on http://www.openmymind.net/FAQ.aspx?documentId=45 i have a problem ... i "converted" it to C# and now it looks like this:

StringBuilder stringBuilder = new StringBuilder();
StringWriter stringWriter;
HtmlTextWriter htmlTextWriter;
try
{
stringWriter = new StringWriter(stringBuilder);
htmlTextWriter = new HtmlTextWriter(stringWriter);
user.RenderControl(htmlTextWriter);
}
finally
{
stringWriter.Close();
htmlTextWriter.Close();
}
Now there was the error at "user.RenderControl(htmlTextWriter);" or even
with "user" with capital u at the beginning.... the method is unknown...
so I changed "user" to "page" ... but now there is this error-message:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
....
[HttpException (0x80004005): A page can have only one server-side Form tag.]
But there is only one form-tag .... I think it's wrong that i chose "page"
.... what is the right?

I dont know what to do....

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schrieb im Newsbeitrag news:uH**************@TK2MSFTNGP10.phx.gbl...
Alexander:
Check out: http://www.openmymind.net/FAQ.aspx?documentId=45

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:O$*************@TK2MSFTNGP15.phx.gbl...
I have a page with the following code for example:

<%@ Page Language="C#" ContentType="text/html"

ResponseEncoding="iso-8859-1"
Debug="true"%>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
texttoview.Text = "this is the text";
}
</script>

<!--#include virtual="/templates/Head.aspx" -->
<title>Title of the page</title>
</head>
<body>
<form runat="server">
<asp:Label runat="server" ID="texttoview" />
</form>
<!--#include virtual="/templates/Footer.aspx" -->

After this page is "generated", or better said the html-code of this
page,

I
want to send this html-code by email to someone.
How can i make this possible? On this page could be a button, which
causes
the sending-process on click.

thank you for your help.



Nov 19 '05 #4
thank you...
now it works

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schrieb im Newsbeitrag news:Oc*************@TK2MSFTNGP15.phx.gbl...
I'll clean up the FAQ, it isn't very clear....

user was a user control, so you would do:

SomeControl someControl = Page.LoadControl("someControl.ascx")

and then do:

someControl.RenderControl(htmlTextWriter);
This is easier done on a UserControl than a Page, so i would suggest you
simply move the page's stuff into a user control.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:u3**************@TK2MSFTNGP15.phx.gbl...
if I follow the manual on
http://www.openmymind.net/FAQ.aspx?documentId=45

i
have a problem ... i "converted" it to C# and now it looks like this:

StringBuilder stringBuilder = new StringBuilder();
StringWriter stringWriter;
HtmlTextWriter htmlTextWriter;
try
{
stringWriter = new StringWriter(stringBuilder);
htmlTextWriter = new HtmlTextWriter(stringWriter);
user.RenderControl(htmlTextWriter);
}
finally
{
stringWriter.Close();
htmlTextWriter.Close();
}
Now there was the error at "user.RenderControl(htmlTextWriter);" or even
with "user" with capital u at the beginning.... the method is unknown...
so I changed "user" to "page" ... but now there is this error-message:
An unhandled exception was generated during the execution of the current

web
request. Information regarding the origin and location of the exception

can
be identified using the exception stack trace below.
....
[HttpException (0x80004005): A page can have only one server-side Form

tag.]

But there is only one form-tag .... I think it's wrong that i chose
"page"
.... what is the right?

I dont know what to do....

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
schrieb im Newsbeitrag news:uH**************@TK2MSFTNGP10.phx.gbl...
> Alexander:
> Check out: http://www.openmymind.net/FAQ.aspx?documentId=45
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) > http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
>
>
> "Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in
> message
> news:O$*************@TK2MSFTNGP15.phx.gbl...
>> I have a page with the following code for example:
>>
>> <%@ Page Language="C#" ContentType="text/html"
> ResponseEncoding="iso-8859-1"
>> Debug="true"%>
>> <script runat="server">
>> void Page_Load(object sender, EventArgs e)
>> {
>> texttoview.Text = "this is the text";
>> }
>> </script>
>>
>> <!--#include virtual="/templates/Head.aspx" -->
>> <title>Title of the page</title>
>> </head>
>> <body>
>> <form runat="server">
>> <asp:Label runat="server" ID="texttoview" />
>> </form>
>> <!--#include virtual="/templates/Footer.aspx" -->
>>
>>
>>
>> After this page is "generated", or better said the html-code of this
>> page,
> I
>> want to send this html-code by email to someone.
>> How can i make this possible? On this page could be a button, which
>> causes
>> the sending-process on click.
>>
>> thank you for your help.
>>
>>
>
>



Nov 19 '05 #5

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

Similar topics

3
by: Erik T. Nomad | last post by:
I've created a link that will enable the reader of any page on my website to click it, enter an e-mail address, and have it arrive in that inbox with a hyperlink to the site. However, I'm...
9
by: Bob Jones | last post by:
We have developed a commercial ASP.net application (personal nutrition management and tracking); we want to send smtp email from within it. For our development box, we use WinXP Pro, IIS 5.5,...
0
by: Chris Lane | last post by:
I am getting the following error when trying to send the mail object: COMException (0x80040213): The transport failed to connect to the server. ] System.RuntimeType.InvokeDispMethod(String...
0
by: Erwan | last post by:
I have a strange (but very blocking) result when using the smtpmail class from an ASPX page : here is the (very simple !) code... '-------------------------------------------------- mail.To =...
3
by: chuckdfoster | last post by:
When using this bit of code, it sends two emails most of the time. Sometimes it doesn't send two, but most of the time it does. I put the system time (Now) in the Subject and each email has a...
2
by: kmbarz | last post by:
I'm trying to expand my horizons here by working through an ASP.Net book. When I do the example that uses: Line 55: Mail.From = "feedback@graymad.com" Line 56: ...
14
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my...
17
by: rdemyan | last post by:
My app creates a building report. My users have requested that I provide functionality to e-mail these "building reports" to building managers once a month. So assuming that I have the...
9
by: Mahernoz | last post by:
Can i send an email from JavaScript? Is it possible? If yes please the code to send email using javascript...
4
by: gurufordy | last post by:
Hello. Trying to use the ASP.net user functionality but it keeps failing on me. I have created a login and registration page for my site. When you fill in the registration form it should send a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.