asp.net ·¢ËÍÓʼþ
web.config:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="chunyou128<you@163.com>">
<network host="smtp.163.com" />
</smtp>
</mailSettings>
</system.net>
C#
try
{
MailAddress from = new MailAddress("mymail@163.com");
MailAddress to = new MailAddress("mymail@163.com");
MailMessage message = new MailMessage(from, to);
message.Subject = "Test Message";//·¢ËÍÓʼþµÄ±êÌâ
message.Body = "yuanyouchun";//·¢ËÍÓʼþµÄÄÚÈÝ
//if (FileUpload1.PostedFile.FileName != "")
//{//·¢Ë͸½¼þ
// Attachment att = new Attachment(FileUpload1.PostedFile.FileName);
// message.Attachments.Add(att);
//}
SmtpClient client = new SmtpClient("smtp.163.com");
client.UseDefaultCredentials
Ïà¹ØÎĵµ£º
Èç¹ûÄã²»×ÜÊÇÓà Windows
É쵀 Internet
Explorer
À´ÉÏÍøµÄ»°£¬Äã¿ÉÄÜ»á×¢Òâµ½£¬Ðí¶àÍøÕ¾ÉϵÄÊÓƵµã²¥Ö®ÀàµÄ¶àýÌåÄÚÈÝ£¬ÄãÎÞ·¨Ö±½ÓÔÚ Internet Explorer
ÒÔÍâµÄÆäËüä¯ÀÀÆ÷Öйۿ´£¬±ÈÈçÃ÷Ã÷ÒѾ°²×°
Á˲å¼þÈ´ÌáʾȱÉÙ²å¼þ£¬»òÕßʲô¶¼²»Ìáʾ³öÏֿյĿò¿ò£¬»òÕßÏÔ
ʾÁ˲¥·ÅÆ÷²å¼þȴʼÖÕÁ¬²»ÉÏ´ò²»¿ªÖ®ÀàµÄÎÊÌ⣠......
WebÀï¼ÓÈë<sessionState cookieless="false" mode="StateServer" timeout="60" stateNetworkTimeout="3600" sqlCommandTimeout="3600"/>ºó±ØÐ루cmdÀïÔËÐÐ:Net Start aspnet_state£©²Å¿ÉÒÔÉèÖÃsessionÖµ¡£
ÕâÒ»¶Î¾ÍÊÇÅäÖÃÓ¦ÓóÌÐòÊÇÈçºÎ´æ´¢SessionÐÅÏ¢µÄÁË¡£ÎÒÃÇÒÔϵĸ÷ÖÖ²Ù×÷Ö÷ÒªÊÇÕë¶ÔÕâÒ»¶ÎÅäÖÃÕ¹ ......
ÔÚijҳÃæÉÏÓÐÈçÏÂÐÅÏ¢£¬
Html£¬
<asp:Button ID="btn" runat="server" Text="Click me" OnClick="ButtonClicked" />
<script language="javascript">
function javascriptMethod() {
alert(1);
}
</script>
C#£¬
protected void ButtonClic ......
¶ÔWebÓ¦ÓóÌÐòÀ´Ëµ£¬·¢Éú²»¿ÉÔ¤ÖªµÄ´íÎóºÍÒì³£ÔÚËùÄÑÃ⣬ÎÒÃDZØÐëΪWeb³ÌÐòÌṩ´íÎó´¦Àí»úÖÆ¡£µ±´íÎó·¢Éúʱ£¬ÎÒÃDZØÐë×öºÃÁ½¼þÊÂÇ飺һÊǽ«´íÎóÐÅÏ¢¼Ç¼ÈÕÖ¾£¬·¢Óʼþ֪ͨÍøվά»¤ÈËÔ±£¬·½±ã¼¼ÊõÈËÔ±¶Ô´íÎó½øÐиú×Ù´¦Àí£»
¶þÊÇÒÔÓѺõķ½Ê½Ìáʾ×îÖÕÓû§Ò³Ãæ·¢ÉúÁË´íÎ󣬶ø²»Äܽ«Î´´¦ÀíµÄ´íÎóÐÅÏ¢ÏÔʾ¸øÓû§¡£
&nbs ......
web.config
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="mymail<you@163.com>">
......