Asp.Net½â¾öSession¶ªÊ§
ÔÚasp.netÀïÃ棬ºÜ¶àʱºòʹÓÃsessionÀ´±£´æһЩ¶ÔÏ󣬱ÈÈç˵¹ºÎï³µµÈµÈ£¬Óкܶàʱºò£¬¾ÍËãÄãÉèÖÃÁËsession³¬Ê±µÄʱ¼ä£¬session»¹ÊÇ»áÎÞÔµÎ޹ʵĶªÊ§£¬ÕâÀïÓÐÒ»ÖֱȽϼòµ¥µÄ·½·¨¿ÉÒÔÉèÖÃsession¶ªÊ§µÄʱ¼ä¡£
ÔÚweb.configÀïÃæÈçÏÂÅäÖÃ
<sessionState
mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="30000" stateNetworkTimeout="144000"
/>
ÆäʵÕâ¾ä»°¾ÍÊÇÀûÓ÷þÎñÆ÷À´±£´æsession£¬ÕâÑù¾Í²»»á¶ªÊ§£¬µ±È»£¬»¹ÒªÔÚ·þÎñÆ÷ÉϽøÐÐÅäÖá£
ÎҵĵçÄÔ-->ÓÒ¼üµã¹ÜÀí-->µã¿ª·þÎñ-->ÕÒµ½asp.net_state Õâ¸ö·þÎñ,Ò²¾ÍÊÇasp.net״̬·þÎñ,ÆôÓþÍÐÐÁË,È»ºóÔÙµ½Global.asax.csÕÒµ½
protected void Session_Start(Object sender, EventArgs e)
{
Session.Timeout = 30000;
}
ÉèÖó¬Ê±Ê±¼ä
ÕâÑù¾ÍÐÐÁË~~
Ïà¹ØÎĵµ£º
ÒÔÇ°×ö.NET winformµÄʱºò£¬Ò»Ö±¶¼ÊÇÓà Console.WriteÏò¿ØÖÆ̨Êä³öÐÅÏ¢µÄ£¬Õâ´Î×öwebµÄʱºò£¬·¢ÏÖÕâ¸öÓï¾äÓò»ÁË¡£
²éÁËÒ»ÏÂ×ÊÁÏ£¬²Å·¢ÏÖweb³ÌÐòÖ´ÐÐʱ£¬ÊDZ»¸½¼Óµ½IIS½ø³ÌµÄÒ»¸öµ¥¶ÀµÄAppDomainÖеģ¬ËùÒÔ¾ÍËãÓÐÊä³öÒ²¿´µ½£¬ËùÒÔConsole.Writeµ÷ÊÔÐÅÏ¢ÎÞ·¨ÏÔʾ³öÀ´¡£
ÄÇô½â¾ö°ì·¨ÊÇ£¬ÓÃdebug´úÌ棺
System.Diagnostics ......
·½°¸1£º
/// <summary>
/// ´«ÈëURL·µ»ØÍøÒ³µÄhtml´úÂë
/// </summary>
/// <param name="Url">URL</param>
/// <returns></returns>
public static string getUrltoHtml(string Url)
{
errorMsg = "";
try
{
System.Net.WebRequest wReq = System.Net.WebReque ......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
¡¡¡¡´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)£¼/script£¾")
¡¡¡¡½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
¡¡¡¡2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1 ......
ÒªÏë×Ô¶¯ÏÔʾ³¬Á´½ÓµÄ¹Ø¼üÔÚÓÚÈçºÎÄÜÕýȷʶ±ð³¬Á´½Ó£¬ºÁÎÞÒÉÎʵģ¬×îÓÐЧµÄ·½·¨ÊÇÓÃÕýÔò±í´ïʽ¡£ÕýÔò±í´ïʽÊÇÓÉÆÕͨ×Ö·û£¨ÀýÈç×Ö·û a µ½ z£©ÒÔ¼°ÌØÊâ×Ö·û£¨³ÆΪԪ×Ö·û£©×é³ÉµÄÎÄ×Öģʽ£¬ÃèÊöÁËÒ»ÖÖ×Ö·û´®Æ¥ÅäµÄģʽ£¬¿ÉÒÔÓÃÀ´¼ì²éÒ»¸ö´®ÊÇ·ñº¬ÓÐijÖÖ×Ó´®¡¢½«Æ¥ÅäµÄ×Ó´®×öÌæ»»»òÕß´Óij¸ö´®ÖÐÈ¡³ö·ûºÏij¸öÌõ¼þµÄ×Ó´®µÈ¡ ......
ÔÚc# / ASP.netÖÐÎÒÃÇ¿ÉÒÔͨ¹ýʹÓÃDataTimeÕâ¸öÀàÀ´»ñÈ¡µ±Ç°µÄʱ¼ä¡£Í¨¹ýµ÷ÓÃÀàÖеĸ÷ÖÖ·½·¨ÎÒÃÇ¿ÉÒÔ»ñÈ¡²»Í¬µÄʱ¼ä£ºÈ磺ÈÕÆÚ£¨2008-09-04£©¡¢Ê±¼ä£¨12£º12£º12£©¡¢ÈÕÆÚ+ʱ¼ä£¨2008-09-04 12£º11£º10£©µÈ¡£
//»ñÈ¡ÈÕÆÚ+ʱ¼ä
DateTime.Now.ToString(); // 2008- ......