ASP.Net 2.0´°ÌåÉí·ÝÑéÖ¤»úÖÆ
±¾ÆªÎÄÕ½éÉÜÁËÔÚASP.Net 2.0ÈçºÎ×ö´°ÌåÉí·ÝÑéÖ¤£¬²¢ÇÒ½²½âÁËIISºÍASP.Net2.0´°ÌåÉí·ÝÑéÖ¤»úÖÆÊÇÈçºÎ½áºÏÔÚÒ»ÆðµÄ¡£ÎÒÃÇ»¹»áÏêϸ½²½âÒ»ÏÂ2.0ÖйØÓÚ´°ÌåÉí·ÝÑéÖ¤µÄÒ»¸öÀࣺFormsAuthenticationModule¡£
l ×ÛÊö
µ±Ä³Ò»¸öÓû§Ê¹ÓÃÓû§Ãû³É¹¦µÇ½Íøվʱ£¬FormsAuthentication£¨´°ÌåÉí·ÝÑéÖ¤»úÖÆ£¬ÏÂÃæͳһʹÓÃÓ¢ÎÄÊõÓ ½«»á´´½¨Ò»¸öauthentication ticket (Éí·ÝÑé֤Ʊ),ͨ¹ýÕâ¸öticket¾Í¿ÉÒÔÔÚÍøÕ¾ÉÏÈ«³Ì¸ú×ÙÕâ¸öÓû§ÁË¡£Form authentication ticketͨ³£±»°üº¬ÔÚÒ»¸öCookieÀïÃ棬µ«ÊÇAsp.net2.0Ò²Ö§³Ö²»Ê¹ÓÃCookieµÄFormsAuthentication£¬Õâʱºòticket¾ÍÐèҪͨ¹ýQuery string ´«µÝ¡£
µ±Ò»¸öÓû§Ôڵǽij¸öÍøվʱ£¬ÐèÒªÌṩÉí·ÝÑéÖ¤²ÅÄܽøÈëÍøÕ¾¡£Èç¹ûËû»¹Ã»ÓÐÊäÈëÑéÖ¤ÐÅÏ¢£¨Í¨³£ÊÇÓû§ÃûºÍÃÜÂ룩£¬Ôò´ËÓû§½«»á±»Öض¨Ïòµ½Ò»¸öµÇ½ҳÃæ¡£Óû§¿ÉÒÔÔڵǽҳÃæÊäÈëÑéÖ¤ÐÅÏ¢£¬È»ºóÕâЩÐÅÏ¢±»·¢Ë͵½·þÎñÆ÷Óëijһ¸ö´æ´¢Óû§Éí·ÝÐÅÏ¢µÄ½éÖÊ£¨ÀýÈçSql Server»òÕßij¸öÎļþ£©½øÐÐÐÅÏ¢¶Ô±È¡£ÔÚASP.Net2.0ÖУ¬¿ÉÒÔͨ¹ýMemberShip ProivderÀ´·ÃÎÊ´æ´¢ÔÚÖîÈçSqlserverµÄÐÅÏ¢¡££¨ProviderģʽÓкܶàÓŵ㣬ÉÔºó»áÓÐÎÄÕÂÏêϸ˵Ã÷¡££©µ±Óû§ÐÅϢͨ¹ýÑéÖ¤ºó£¬´ËÓû§½«»ñµÃÔÊÐí£¬·ÃÎÊËûËùÆÚÍûµÄÒ³Ãæ¡£
FormsAuthenticationͨ¹ýFormsAuthenticationModuleÕâ¸öÀàÀ´Ö´ÐУ¬Õâ¸öÀàÊÇASP.netÒ³ÃæÔËÐÐÖÜÆÚµÄÒ»²¿·Ö¡£ÒÔÏÂÎÒÃǽ«½âÊÍFormsAuthenticationÔÚASP.net2.0ÖÐÊÇÈçºÎ¹¤×÷µÄ¡£
l IIS ÑéÖ¤
Asp.netÑéÖ¤·ÖΪÁ½²½¡£Ê×ÏÈ£¬IISÑéÖ¤µ±Ç°Óû§·ÃÎÊÍøÕ¾ËùʹÓõÄwindowsÕʺÅÊÇ·ñÓÐȨÏÞ¡£Èç¹ûIIS·ÃÎʱ»ÅäÖÃΪanonymous£¬ÔòÈκÎÓû§¶¼ÄÜ·ÃÎÊÒ³Ãæ¡£
È»ºó£¬ÔÚIISÑéÖ¤Íê±Ïºó£¬ASP.net¿ªÊ¼Ö´ÐÐ×ÔÉíµÄÑéÖ¤¡£Ñé֤ģʽ¿ÉÒÔÔÚweb.configÎļþÖÐÅäÖã¬Ö»ÒªÔÚconfigÎļþÖÐдÉÏ<authentication mode="Forms" />£¬ÄÇôASP.net¾ÍÖªµÀʹÓÃFormsAuthenticationModule Àà½øÐÐÑéÖ¤¡£
l Asp.Net froms Authentication
froms Authentication ÅäÖãºÄã¿ÉÒÔÔÚconfigÎļþÖÐÅäÖá£ÅäÖÃÈçÏ£º
<system.web>
<authentication mode="Forms">
<forms loginUrl="Login.aspx"
protection="All"
timeout="30"
name=".ASPXAUTH"
path="/"
requireSSL="false"
slidingExpiration="true"
defaultUrl="default.aspx"
co
Ïà¹ØÎĵµ£º
ʹÓÃASP.NET 2.0 Profile´æ´¢Óû§ÐÅÏ¢[·Òë] Level 200
×÷Õß: Stephen Walther
ÔÎĵØÖ·£ºhttp://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnvs05/html/UserProfiles.asp
ÒëÕߣºTony Qu
¸ÅÒª£ºÐí¶àASP.NETÓ¦ÓóÌÐòÐèÒª¿ç·ÃÎʵÄÓû§ÊôÐÔ¸ú×Ù¹¦ÄÜ£¬ÔÚASP.NET1.1ÖУ¬ÎÒÃÇÖ»ÄÜÈ˹¤ÊµÏÖÕâÒ»¹¦ÄÜ¡£µ«Èç ......
ÔÚʹÓÃasp.net±àдwebserviceʱ£¬Ä¬ÈÏÇé¿öÏÂÊDz»Ö§³ÖsessionµÄ£¬µ«ÎÒÃÇ¿ÉÒÔ°ÑWebMethodµÄEnableSessionÑ¡ÏîÉèΪtrueÀ´ÏÔʽµÄ´ò¿ªËü£¬Çë¿´ÒÔÏÂÀý×Ó£º
1 н¨ÍøÕ¾WebSite
2 н¨web·þÎñWebService.asmx£¬Ëü¾ßÓÐÒÔÏÂÁ½¸ö·½·¨£º
[WebMethod(EnableSession = true)]
public string Login(string name)
{
  ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;
using System.Text; ......
¾ÍÊÇÔÚʹÓÃjmail·¢ËÍÓʼþʱ£¬Ê¹ÓõÄÊÇ×Ô¶¯É¨Ãè¹æ¶¨¼ä¸ôʱ¼ä×Ô¶¯·¢Ë͵ģ¬ÏÖÔÚÊÇÏëʵÏÖÒѾ·¢Ë͵ÄÓʼþ½«²»ÔÙ·¢ËÍ£¬¸÷λ´óϺÔõôʵÏÖ£¬ÇóÖú£¡
Ê×ÏÈÃ÷È·µÄÊÇÔÚÊý¾Ý¿â±íÖв¢Ã»Óбêʶ×Ö¶ÎÀ´±æ±ðÓʼþÊÇ·ñÒѾ·¢ËÍ¡£Èç¹ûÎÒÀ´ÉèÖÃÒ»¸öÈ«¾Ö±äÁ¿À´´æ´¢ÕâЩÒѾ·¢ËÍÓʼþµÄID£¬È»ºóÔÚÔÙ´ÎɨÃèʱÀ´±æ±ðÕâЩIDÊÇ·ñÒѾ´æÔڵķ½Ê½À´Åжϣ¬¸ ......
//ʵÀý»¯Ò»¸öSmtpClientsmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
SmtpClient smtp = new SmtpClient();
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
//½«smtpµÄ³öÕ¾·½Ê½ÉèΪ Networksmtp.EnableSsl = false;
//smtp·þÎñÆ÷ÊÇ·ñÆôÓÃSSL¼ÓÃÜ
smtp ......