ASP.NET 2.0·¢Ë͵ç×ÓÓʼþÈ«ÃæÆÊÎöÖ®¶þ
³ö´¦£ºÌ켫Íø ×÷ÕߣºÖìÏÈÖÒ±àÒë ʱ¼ä£º2006-9-25 9:36:00
Ò»¡¢¼ò½é
ÔÚÉÏƪÖÐÎÒÃÇÏêϸ·ÖÎö¹ý£¬.NET¿ò¼Ü2.0°æ±¾ÌṩÁËÒ»¸öеÄÃüÃû¿Õ¼ä(System.Net.Mail)ºÍһЩ·¢Ë͵ç×ÓÓʼþµÄÐÂÀà(×¢Ò⣺.NET¿ò¼Ü1.x°æ±¾ÖÐÌṩµÄÃüÃû¿Õ¼äSystem.Web.Mail¼°Ïà¹ØµÄÀàÈÔÈ»¿ÉÒÔʹÓã¬ÒÔʵÏÖÏòºó¼æÈÝÐÔ)¡£¶øÇÒ£¬ÎÒÃÇ»¹Ïêϸ·ÖÎö¹ýÈçºÎʹÓÃSystem.Net.MailÃüÃû¿Õ¼äÖеÄMailMessageºÍSmtpClientÀàÀ´·¢Ëͼòµ¥µÄÆÕͨÎı¾¸ñʽµÄµç×ÓÓʼþÏûÏ¢¡£
±¾Æª½«ÌÖÂÛÓëµç×ÓÓʼþÏà¹ØµÄ¸ü¸ß¼¶µÄÑ¡Ïî¡£ÎÒÃÇÒª·ÖÎöÈçºÎ·¢ËÍHTML¸ñʽµÄµç×ÓÓʼþ£¬ÈçºÎ°üÀ¨¸½¼þ£¬ÒÔ¼°µ±·¢ËÍÒ»¸öµç×ÓÓʼþʱÈçºÎÓÅÑŵش¦ÀíSMTPÒì³£(ÀýÈçÎÞЧµÄÖм̷þÎñÆ÷ƾ֤»òÈç¹û¸ÃÖм̷þÎñÆ÷´¦ÓÚÀëÏß״̬)¡£
±¾Îļٶ¨ÄãÒѾÊìϤ´ÓÒ»¸öASP.NET 2.0 webÒ³Ãæ·¢Ëͼòµ¥µÄÆÕͨÎı¾µç×ÓÓʼþ£»·ñÔòµÄ»°£¬ÇëÊ×ÏÈÔĶÁ±¾ÏµÁÐÎÄÕÂÖеÄÉÏƪ¡£
¶þ¡¢·¢ËÍHTML¸ñʽµÄµç×ÓÓʼþ
ÔÚASP.NET 2.0Öз¢Ë͵ç×ÓÓʼþʱ£¬ÎÒÃÇÒѾ¿´µ½ÈçºÎ·¢ËÍÆÕͨÎı¾µç×ÓÓʼþ£¬ÕâÊÇͨ¹ý°Ñµç×ÓÓʼþÄÚÈݸ³¸øMailMessageÀàµÄBodyÊôÐÔʵÏֵġ£Æäʵ£¬ÎªÁË·¢ËÍHTM¸ñʽµÄµç×ÓÓʼþ£¬ÎÒÃÇÖ»Òª¼òµ¥µØ°ÑBodyÊôÐÔÉèÖÃΪҪ·¢Ë͵ÄHTMLÄÚÈÝ£¬È»ºó°ÑMailMessageÀàµÄIsBodyHtmlÊôÐÔÉèÖÃΪTrue¼´¿É¡£
ΪÁËÑÝʾÈçºÎ·¢ËÍÒ»¸öHTML¸ñʽµÄÏûÏ¢£¬ÎÒ´´½¨ÁËÒ»¸öʾÀý£¬ÆäÃû×ÖΪHtmlEmail.aspx¡£´úÂëÈçÏ£º '(1)´´½¨MailMessageʵÀý
Dim mm As New MailMessage(fromEmailAddress£¬ ToEmailAddress)
'(2)¸³ÖµMailMessageµÄÊôÐÔ
mm.Subject = "HTML-Formatted Email Demo Using the IsBodyHtml Property"
mm.Body = "£¼h2£¾This is an HTML-Formatted Email Send Using the £¼code£¾IsBodyHtml£¼/code£¾ Property£¼/h2£¾£¼p£¾Isn't HTML £¼em£¾neat£¼/em£¾?£¼/p£¾£¼p£¾You can make all sorts of £¼span style=""color:red;font-weight:bold;""£¾pretty colors!!£¼/span£¾.£¼/p£¾"
mm.IsBodyHtml = True
'(3) ´´½¨SmtpClient¶ÔÏó
Dim smtp As New SmtpClient
'(4)·¢ËÍMailMessage (½«Ê¹ÓÃWeb.configÉèÖÃ)
smtp.Send(mm) ÈçÄãËù¼û£¬¼òµ¥µØ°ÑBodyÊôÐÔÉèÖÃΪҪ·¢Ë͵ÄHTMLÄÚÈÝ£¬²¢ÇÒ°ÑIsBodyHtmlÊôÐÔÉèÖÃΪTrue¡£ÖÁ´Ë£¬ËùÓÐÕâЩÄãÒѾÍê³É£¡±»·¢Ë͵½Öм̷þÎñÆ÷µÄʵ¼Êµç×ÓÓʼþÄÚÈÝ(²¢ÇÒ×îºóÒªµ½´ï½ÓÊÕÕߵĵç×ÓÓʼþ¿Í»§¶Ë)¿´ÉÏÈ¥ÈçÏÂËùʾ£º x-sender: ToEmailAddress
x-receiver: fromEmailAddress
Ïà¹ØÎĵµ£º
TreeView ¿Ø¼þµÄ³ÊÏÖÊÇ¿ÉÍêÈ«×Ô¶¨ÒåµÄ£¬ÕâʹµÃ¿ÉÒÔʹÓöàÖÖ¶àÑùµÄÏÔʾÑùʽ¡£
ÈôÒª×Ô¶¨Òå TreeView ¿Ø¼þµÄÍâ¹Û£¬¿ÉÒÔÖ´ÐÐÒÔϲÙ×÷£º
·Ö¸¶¨Ó°Ïì¿Ø¼þÏÔʾºÍ³ÊÏÖµÄ TreeView ¿Ø¼þÊôÐÔ¡£
·Ö¸¶¨Ò»¸ö ImageSet ÊôÐÔ£¬¸ÃÊôÐÔÑ¡ÔñÒ»×éÔÚÔËÐÐʱͬ¿ ......
TreeView Web ·þÎñÆ÷¿Ø¼þ¿ÉÒÔÏÔʾ¸÷ÖÖ²»Í¬ÀàÐ͵ÄÊý¾Ý£º¿Ø¼þÖÐÒÔÉùÃ÷·½Ê½Ö¸¶¨µÄ¾²Ì¬Êý¾Ý£»°ó¶¨µ½¸Ã¿Ø¼þµÄÊý¾Ý£»»òΪÏìÓ¦Óû§²Ù×÷¶ø¶¯Ì¬Ìí¼Óµ½ TreeView ¿Ø¼þÖеÄÊý¾Ý¡£
Ò»¡¢ÏÔʾ¾²Ì¬Êý¾Ý
×î¼òµ¥µÄÊý¾Ý¼Ü¹¹ÊÇÉùÃ÷ÐÔ¾²Ì¬Êý¾Ý¡£ÈôҪʹÓÃÉùÃ÷ÐÔÓï·¨ÏÔʾ¾²Ì¬Êý¾Ý£¬Çë´´½¨Ò»¸ö TreeView ¿Ø¼þ× ......
//2007Äê4ÔÂ24ÈÕ
this.TextBox6.Text = System.DateTime.Now.ToString("D");
//2007-4-24
this.TextBox7.Text = System.DateTime.Now.ToString("d");
//2007Äê4ÔÂ24ÈÕ 16:30:15
this. ......
¡¡¡¡
¡¡¡¡ÄÚÈݼò½é
¡¡¡¡±¾ÊéÊÇASP.NETµÄÈëÃŽ̡̳£ASP.NET 3.5ÊÇ΢Èí¾«ÐÄ´òÔìµÄÐÂÐ͵ÄÈí¼þ¿ª·¢Æ½Ì¨¡£¸Ãƽ̨ÊÇÔÚ.NET2.0µÄ»ù´¡ÉÏ·¢Õ¹¶øÀ´£¬ÔÚʵ¼Ê¿ª·¢ÖÐÓй㷺ӦÓᣱ¾ÊéÒ»¹²·ÖΪËÄƪ£¬µÚһƪÖ÷Òª½²½âÁËASP.NEµÄÈëÃÅ»ù´¡ÖªÊ¶£¬ÄÚÈÝ°üÀ¨´î½¨ASP.NET¿ª·¢»·¾³¡¢C#ÓïÑÔ»ù´¡¡¢ÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼Æ¡¢ASP.NETÄÚÖöÔÏó¡¢ASP.NETҳà ......
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
  ......