Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ASP.NET¶þ¼¶ÓòÃûÕ¾µã¹²ÏíSession״̬


ASP.NET¶þ¼¶ÓòÃûÕ¾µã¹²ÏíSession״̬
2010-01-15 10:44
ÎÒµÄÇ°ÃæÒ»ÆªÎÄÕÂÌáµ½ÁËÈçºÎÔÚʹÓÃÁËASP.NET form authenticationµÄ¶þ¼¶Õ¾µãÖ®¼ä¹²ÏíµÇ½״̬£¬
http://www.cnblogs.com/jzywh/archive/2007/09/23/902905.html£¬
½ñÌ죬 ÎÒҪдµÄÊÇÈçºÎÔÚ¶þ¼¶ÓòÃûÕ¾µãÖ®¼ä,Ö÷Õ¾µãºÍ¶þ¼¶ÓòÃûÕ¾µãÖ®¼ä¹²ÏíSession¡£
Ê×ÏÈ, SessionÒª¹²Ïí£¬Õ¾µãÖ®¼äSessionID±ØÐëÒªÒ»Ö£¬ÄÇÔõô±£Ö¤SessionIDÒ»ÖÂÄØ£¿
ASP.NET
ÖеÄSessionIDÊÇ´æ´¢ÔÚ¿Í»§¶ËµÄcookieÖ®ÖмüֵΪASP.NET_SessionIdÓÃÀ´Î¬»¤ä¯ÀÀÕßSession¶ÔÓ¦¹ØÏµµÄÒ»¸ö×Ö·û´®£¬
ÒªÏëÔÚ¶þ¼¶ÓòÃûÕ¾µãÖ®¼ä,Ö÷Õ¾µãºÍ¶þ¼¶ÓòÃûÕ¾µã¹²ÏíSessionID¾Í±ØÐëÏȹ²Ïí£¬ÄÇôÎÒÃǾͱØÐëÏÈʵÏÖASP.NET_SessionIdÕâÒ»
cookieµÄ¹²Ïí¡£
CrossDomainCookieModule
------------------------------------------------------------------------------------------------
public class CrossDomainCookie : IHttpModule
{
private string m_RootDomain = string.Empty;
#region IHttpModule Members
public void Dispose()
{
}
public void Init(HttpApplication context)
{
m_RootDomain = ConfigurationManager.AppSettings["RootDomain"];
context.EndRequest += new System.EventHandler(context_EndRequest);
}
void context_EndRequest(object sender, System.EventArgs e)
{
HttpApplication app = sender as HttpApplication;
for (int i = 0; i < app.Context.Response.Cookies.Count; i++)
{
app.Context.Response.Cookies[i].Domain = m_RootDomain;
}
}
#endregion
}
ÉÏ
ÃæµÄModuleÖØÉèÁËËùÓÐcookieµÄdomainµ½root domain, root
domainÔÚweb.configÖÐÉèÖá£Ò²ÐíÓÐÈË»á˵ÕâÊÇüëºú×ÓÒ»°Ñ×¥ÖØÐ´ÁËËùÓÐcookieµÄdomain,
ÄÇËûÒ²¿ÉÒÔÅжÏÒ»ÏÂcookieµÄname, Èç¹ûΪASP.NET_SessionIdµÄ»°²ÅÖØÐ´¡£
Èç¹ûÖ÷Õ¾µãºÍ¶þ¼¶ÓòÃûÕ¾µãÊÇͬһվµã£¬ÄÇô×öµ½ÕâÒ»²½£¬ÄãµÄsession¾ÍÒѾ­¹²ÏíÁË£¬ÒòΪSessionµÄIDÊÇÏàͬµÄ£¬¶øÇÒSessionÈÝÆ÷Ò²ÊÇͬһ¸ö¡£
Èç¹ûÖ÷Õ¾µãºÍ¶þ¼¶ÓòÃûÕ¾µãÊÇÁ½¸ö²»Í¬Õ¾µã£¬ÔòÐèÒª½øÐиü¶àµÄ²Ù×÷ÁË¡£
Èç¹ûÁ½¸öÕ¾µãÊDz»Í¬µÄ·þÎñÆ÷µÄ»°£¬½â¾ö·½·¨Òª¼òµ¥µã:
1) ʹÓÃÏàͬµÄstate serverÀ´


Ïà¹ØÎĵµ£º

dz̸ASP.net°²È«±à³Ì

ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔǰµÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕß¶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......

asp.net ÎÄÕÂÄÚÈÝ·ÖÒ³ÏÔʾµÄ´úÂë

aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ArticlePage.aspx.cs" Inherits="ArticlePage" %>
<!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" > ......

Cascading DropDownLists With ASP.NET and jQuery


Cascading drop down lists is a really nice feature for web developers. I thought it was time to write an article on how to do this using ASP.NET and jQuery. Well here’s one way of doing it. Before we get started, this example uses the latest version of jQuery which is 1.3.2.&n ......

ASP.NET ʼþ˳Ðò

1.Init£¨³õʼ»¯½×¶Î£©
2.LoadViewState£¨ÔØÈëÊÓͼ״̬£©
3.LoadPostData£¨´¦Àí»Ø·¢Êý¾Ý£©
    public   virtual   bool   LoadPostData(string   postDataKey,   NameValueCollection   postCollection)
     ÅжÏÊÓÍ ......

ASP.NET 2.0 ¶þ¼¶ÓòÃûFormsÑé֤ģʽϹ²ÏíµÇ½״̬

ÔÚasp.net 1.1ÖÐ, ¶þ¼¶ÓòÃûFormsÑé֤ģʽϹ²ÏíµÇ½״̬µÄ·½·¨Çë²Î¿¼ÏÂÃæÎÄÕÂ:
http://www.cnblogs.com/caomao/archive/2005/07/05/186606.html
¶øÔÚasp.net 2.0ÖÐʵÏÖ·½·¨¸üΪ¼òµ¥£¬Ö»ÐèÐÞ¸Äweb.configÎļþ¼´¿É£¬Ð޸ķ½·¨ÈçÏÂ:
<authentication mode="Forms">
    <forms name ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ