ASP.NET·¢ËÍEmail¾«¼ò°æ
using System.Net;
using System.Net.Mail;
using System.Text;
#region ·¢ËÍEmail
public void sendEmail()
{
#region ÑéÖ¤email
SmtpClient smtp = new SmtpClient(); //ʵÀý»¯Ò»¸öSmtpClient
smtp.DeliveryMethod = SmtpDeliveryMethod.Network; //½«smtpµÄ³öÕ¾·½Ê½ÉèΪ Network
smtp.EnableSsl = false;//smtp·þÎñÆ÷ÊÇ·ñÆôÓÃSSL¼ÓÃÜ
smtp.Host = "smtp.sina.net"; //Ö¸¶¨ smtp ·þÎñÆ÷µØÖ·
smtp.Port = 25;//Ö¸¶¨ smtp ·þÎñÆ÷µÄ¶Ë¿Ú£¬Ä¬ÈÏÊÇ25£¬Èç¹û²ÉÓÃĬÈ϶˿ڣ¬¿ÉÊ¡È¥
smtp.UseDefaultCredentials = true; //Èç¹ûÄãµÄSMTP·þÎñÆ÷²»ÐèÒªÉí·ÝÈÏÖ¤£¬ÔòʹÓÃÏÂÃæµÄ·½Ê½£¬²»¹ý£¬Ä¿Ç°»ù±¾Ã»Óв»ÐèÒªÈÏÖ¤µÄÁË
smtp.Credentials = new NetworkCredential("123@456.com","123456"); //EmailÕ˺źÍÃÜÂë
#endregion
#region ËÍÐÅÈË
MailMessage mm = new MailMessage(); //ʵÀý»¯Ò»¸öÓʼþÀà
mm.Priority = MailPriority.High;//ÓʼþµÄÓÅÏȼ¶£¬·ÖΪ Low, Normal, High£¬Í¨³£Óà Normal¼´¿É
mm.from = new MailAddress("123@456.com", "·¢ÐÅÈËÃû³Æ", Encoding.GetEncoding(936));
#endregion
#region ÊÕÐÅÈË
mm.To.Add(new MailAddress(email, email, Encoding.GetEncoding(936)));//µ±È»Ò²¿ÉÒÔÓÃÈ«µØÖ·Ìí¼Ó
mm.Subject = "ÄúÔÚXXXXXÍøµÄ×¢²áÐÅÏ¢"; //Óʼþ±êÌâ
mm.SubjectEncoding =
Ïà¹ØÎĵµ£º
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" & ......
Asp.netΪÎÒÃÇÌṩÁËÁù¸öÑéÖ¤ÑéÖ¤¿Ø¼þ¼°ÆäÒªÆð×÷ÓñØÐëÉèÖõÄÊôÐÔ£º
(1) RequiredFieldValidator£º¸Ã¿Ø¼þÒªÇóÆä°ó¶¨µÄÊäÈë¿Ø¼þÒ»¶¨ÒªÓÐÊäÈëÖµ£¬²»ÄÜΪ¿Õ£»
ÊôÐÔ£ºControlToValidate:ÑéÖ¤¿Ø¼þÒªÑéÖ¤µÄÊäÈë¿Ø¼þID£¨°ó¶¨µÄÊäÈë¿Õ¼äID£©
Text£ºÊäÈë¿Ø¼þÊäÈëµÄÄÚÈݲ» ......
Ò».ʹÓÃQueryString
Request.QueryString
ÔÚASPʱ´ú£¬Õâ¸öÊǽϳ£Óõķ½·¨£¬µ½ÁËASP.NET£¬ºÃÏñÓõÄÈ˲»¶àÁË£¬µ«ÊDz»¹ÜÔõô˵£¬ÕâÊÇÒ»¸öûÓйýʱ£¬ÇÒºÜÖµµÃÍƼöµÄ·½·¨£¬ÒòΪ²»¹ÜÊÇASP»¹ÊÇASP.NET£¬×î»ù±¾µÄ¶¼»¹ÊÇ»ùÓÚHTTpÐÒéµÄ¡£ ȱµãÊǷdz£Ã÷ÏԵģ¬ÈÃÔÚ¶à¸öÒ³Ãæ´«µÝʱ£¬¿ÉÄܾÍRequest²»µ½ÁË
ʹÓÃQu ......
·½·¨Ò»£º
function document.onkeydown()
{
if(event.keyCode==13)
{
document.form1.all.Submit.click(); //ÕâÀïµÄsubmitÊÇ°´Å¥µÄID
}
}
·½·¨¶þ£º
......
<a>±êÇ©
1. <a href=”test.aspx”></a>
2. ÕâÊÇ×î³£¼ûµÄÒ»ÖÖתÏò·½·¨;
HyperLink¿Ø¼þ
1. Asp.net ·þÎñÆ÷¶Ë¿Ø¼þ ÊôÐÔNavigateUrlÖ¸¶ ......