📄 recommend.aspx.cs
字号:
//-----------------------------------------------------------------------------
//
// WebExpert.NET 1.0
//
// (c) 2003, www.AspCool.com. All rights reserved.
// ASP酷技术网版权所有
//
// 该源码下载自:http://www.51aspx.com
// 邮箱:tim@aspcool.com
//
// 版权声明:本程序仅供学习使用,你也可以修改后在网站上使用,但使用时必
// 须保留ASP酷技术网(www.AspCool.com)的版权信息和链接。本程序随《ASP.NET
// 网站建设专家》一书赠送,未经作者同意,不得随意修改、传播。
//
// 描述:
// 此文件包含下面的类:
// Recommend
//
// 作者: 王保健
// 时间: 2003/09/15
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;
using System.Web.Mail;
namespace AspCool.WebExpert.Recommend
{
/// <summary>
/// Recommend 的摘要说明。
/// </summary>
public class Recommend : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox uName;
protected System.Web.UI.WebControls.TextBox uMail;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.TextBox fName;
protected System.Web.UI.WebControls.TextBox fMail;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.TextBox txtContent;
protected System.Web.UI.WebControls.Button btnSend;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnSend.Click += new System.EventHandler(this.btnSend_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnSend_Click(object sender, System.EventArgs e)
{
string sContent;
MailMessage msg=new MailMessage();
msg.BodyFormat=MailFormat.Html;
msg.Subject="我找到了一个好网站";
msg.From=uMail.Text;
msg.To=fMail.Text;
if (Request["Url"] == null)
{
sContent = "<style type=\"text/css\"><!--/n.page { font-size: 9pt; font-style: normal; font-weight: normal; font-variant: normal;line-height: 12pt;}body, table {font-size: 9pt; }A{text-transform: none; text-decoration: none;}--></style>"+ fName.Text +",您好:<br><br>"+"您的朋友"+ uName.Text + "把<a href=http://www.aspcool.com>ASP酷技术网</a>推荐给您。";
if (Request["content"]!="")
{
sContent +="他/她想对您说:<br><br><I>"+ txtContent.Text +"</I><br>";
}
}
else
{
sContent = "<style type=\"text/css\"><!--/n.page { font-size: 9pt; font-style: normal; font-weight: normal; font-variant: normal;line-height: 12pt;}body, table {font-size: 9pt; }A{text-transform: none; text-decoration: none;}--></style>"+ fName.Text +",您好:<br><br>"+"您的朋友"+ uName.Text + "把下面这篇文章推荐给您。请查看:<br>";
sContent += "<a href=" + Request.Url + ">" + Request.Url + "</a><br>";
if (Request["content"]!="")
{
sContent +="他/她想对您说:<br><br><I>"+ txtContent.Text +"</I><br>";
}
}
sContent +="<br>";
sContent +="<br><br>谢谢!";
msg.Body = sContent;
msg.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["smtpserver"];
SmtpMail.Send(msg);
Response.Write("您的推荐信已经发出,请点此返回。");
Response.End();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -