469,270 Members | 1,780 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

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 2292
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Erik T. Nomad | last post: by
9 posts views Thread by Bob Jones | last post: by
reply views Thread by Chris Lane | last post: by
3 posts views Thread by chuckdfoster | last post: by
2 posts views Thread by kmbarz | last post: by
9 posts views Thread by Mahernoz | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.