Invisible ASP.NET action

T

Tor Inge Rislaa

Invisible ASP.NET action

I have an .aspx page with some controls and a SEND button that are sending
an e-mail based on the content in some textbox's. Is it possible to call the
page with some parameters, so that the code sending the e-mail is executed
on the server without showing any page and the content from the textbox's is
replaced with the parameter values?

The code below is what I am testing on today:

<%@ Import Namespace="System.Web.Mail" %>

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1"
Debug="true" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>Sending Mail</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script runat="server">

Sub Button_Click(s as Object, e as EventArgs)

Dim objMail = new MailMessage

objMail.From = "(e-mail address removed)"

objMail.To = email.Text

objMail.Subject = subject.Text

objMail.Body = "This is the body"

SmtpMail.SmtpServer = "localhost"

SmtpMail.Send(objMail)

End Sub

</script>

</head>

<body>

<h3>Sending Mail with IIS</h3>

<form action="frmSendingMail.aspx" method="post" name="form1" id="form1"
runat="server">


E-Mail:

<asp:TextBox Columns="30" ID="email" ReadOnly="false" TextMode="SingleLine"
runat="server" />

Subj:

<asp:TextBox Columns="30" ID="subject" TextMode="SingleLine"
runat="server"/> <br>

<br>

Send:

<asp:Button ID="btnSubmit" OnClick="Button_Click" runat="server" Text="Send"
value="" />

</form>

</body>

</html>



TIRislaa
 
A

Alvin Bruney [MVP - ASP.NET]

yes, one approach is to use the querystring variable

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,141
Latest member
BlissKeto
Top