473,785 Members | 2,221 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

send mail with page-html-content

I have a page with the following code for example:

<%@ Page Language="C#" ContentType="te xt/html" ResponseEncodin g="iso-8859-1"
Debug="true"%>
<script runat="server">
void Page_Load(objec t 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 2479
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.inv alid.de> wrote in message
news:O$******** *****@TK2MSFTNG P15.phx.gbl...
I have a page with the following code for example:

<%@ Page Language="C#" ContentType="te xt/html" ResponseEncodin g="iso-8859-1" Debug="true"%>
<script runat="server">
void Page_Load(objec t 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(st ringBuilder);
htmlTextWriter = new HtmlTextWriter( stringWriter);
user.RenderCont rol(htmlTextWri ter);
}
finally
{
stringWriter.Cl ose();
htmlTextWriter. Close();
}
Now there was the error at "user.RenderCon trol(htmlTextWr iter);" 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******** ******@TK2MSFTN GP10.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.inv alid.de> wrote in message
news:O$******** *****@TK2MSFTNG P15.phx.gbl...
I have a page with the following code for example:

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

ResponseEncodin g="iso-8859-1"
Debug="true"%>
<script runat="server">
void Page_Load(objec t 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.LoadContro l("someControl. ascx")

and then do:

someControl.Ren derControl(html TextWriter);
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.inv alid.de> wrote in message
news:u3******** ******@TK2MSFTN GP15.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(st ringBuilder);
htmlTextWriter = new HtmlTextWriter( stringWriter);
user.RenderCont rol(htmlTextWri ter);
}
finally
{
stringWriter.Cl ose();
htmlTextWriter. Close();
}
Now there was the error at "user.RenderCon trol(htmlTextWr iter);" 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******** ******@TK2MSFTN GP10.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.inv alid.de> wrote in message
news:O$******** *****@TK2MSFTNG P15.phx.gbl...
I have a page with the following code for example:

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

ResponseEncodin g="iso-8859-1"
Debug="true"%>
<script runat="server">
void Page_Load(objec t 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******** *****@TK2MSFTNG P15.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.LoadContro l("someControl. ascx")

and then do:

someControl.Ren derControl(html TextWriter);
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.inv alid.de> wrote in message
news:u3******** ******@TK2MSFTN GP15.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(st ringBuilder);
htmlTextWriter = new HtmlTextWriter( stringWriter);
user.RenderCont rol(htmlTextWri ter);
}
finally
{
stringWriter.Cl ose();
htmlTextWriter. Close();
}
Now there was the error at "user.RenderCon trol(htmlTextWr iter);" 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******** ******@TK2MSFTN GP10.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.inv alid.de> wrote in
> message
> news:O$******** *****@TK2MSFTNG P15.phx.gbl...
>> I have a page with the following code for example:
>>
>> <%@ Page Language="C#" ContentType="te xt/html"
> ResponseEncodin g="iso-8859-1"
>> Debug="true"%>
>> <script runat="server">
>> void Page_Load(objec t 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
3350
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 wondering if there's a way to customize it further, such that the hyperlink they are sent is the web address of the page the "send to friend" link was on. I don't want to convert my entire site over to .asp, so having a pop-up .asp page seems to make...
9
4311
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, VisualStudio2002, VB as programing language. Our test/development version of the web app as hosted on our "localhost" works fine; our "Default SMTP Virtual Server" is running (per the IIS console).
0
1130
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 name, BindingFlags invokeAttr, Object target, Object args, Boolean byrefModifiers, Int32 culture, String
0
2536
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 = "el@illico.fr" mail.From = "el@illico.fr" mail.Subject = "test envoi de mail" mail.Body = "test envoi de mail"
3
3500
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 different time by a minute or so. I also tried to count the number of emails it is sending by using the intEmail = intEmail + 1, but the number is always 1.Could anyone tell me why this is happening or give me advice on how to change it. Thanks...
2
1841
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: SmtpMail.SmtpServer = "localhost" Line 57: SmtpMail.Send(Mail) I get: myemail@comcast.net
14
9143
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 local default SMTP Server and my from address is a valid Yahoo/Hotmail address. I have configures the local SMTP Server to allow the IP Address 127.0.0.1.
17
7648
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 following table that lists a building manager's name, e-mail address and their building, is there a way that I can automate this to send these monthly e-mails from Outlook. Ideally this would be a click one button type of action:
9
77444
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
3822
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 confirmation email with a link to activate the account. Nothing hi-tech here. However, it fails to send the email and provides the following error message: Transaction failed. The server response was: sorry, the sender name and auth login doesn't...
0
9489
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
10356
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...
1
10100
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
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
7509
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
5396
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
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4061
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
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.