asp.net¶¨Ê±Ö´ÐдúÂë
string LogPath;
Thread thread;
void WriteLog()
{
while (true)
{
StreamWriter sw = new StreamWriter(LogPath, true, Encoding.UTF8);
sw.WriteLine(thread.Name + ":" + DateTime.Now.ToString());
sw.Close();
Thread.CurrentThread.Join(1000 * 60);//×èÖ¹1·ÖÖÓ
}
}
void Application_Start(object sender, EventArgs e)
{
LogPath = HttpContext.Current.Server.MapPath("log.txt");
//ÔÚÓ¦ÓóÌÐòÆô¶¯Ê±ÔËÐеĴúÂë
thread = new Thread(new ThreadStart(WriteLog));
thread.Name = "дµÇ¼ÈÕÖ¾Ïß³Ì";
thread.Start();
}
Ïà¹ØÎĵµ£º
1.ASP.NETÔËÐÐÔÀí¸ÅÊö
¡¡¡¡ÈçÉÏͼ£¬µ±Ò»¸öhttpÇëÇó·¢Ë͹ýÀ´²¢±»IIS»úÊÕµ½Ö®ºó,IISÊ×ÏÈͨ¹ýÄãÇëÇóµÄÒ³ÃæÀàÐÍΪÆä¼ÓÔØÏàÓ¦µÄdllÎļþ£¬È»ºóÔÚ´¦Àí¹ý³ÌÖн«ÕâÌõÇëÇó·¢Ë͸øÄܹ»´¦ÀíÕâÌõÇëÇóµÄÄ£¿é,¶øÔÚASP.NETÖÐÕâ¸öÄ£¿é¾Í½Ð×öHttpHandler,ΪʲôaspxÕâÑùµÄÎļþ¿ÉÒÔ±»·þÎñÆ÷´¦Àí,ÄÇÊÇÒòΪÔÚ·þÎñÆ÷¶ËÓÐĬÈϵÄHttpHandlerרÃÅ´ ......
asp.netʵÏÖα¾²Ì¬
Ò»¡¢Î±¾²Ì¬µÄÓô¦
ÓÐЩÓû§
¾õµÃ£¬Î±¾²Ì¬ºÍÕæ¾²Ì¬Êµ¼Ê±»ÊÕ¼Á¿»áÏà²îºÜ´ó£¬Æäʵ²»È»£¬´ÓÄã¸öÈ˽Ƕȣ¬Äã
È¥ÅжÏÒ»ÏÂÒ»¸öÌû×Óµ½µ×ÊÇÕæ¾²Ì¬»¹ÊÇα¾²Ì¬£¿¹À¼ÆºÜÄÑ¿´µÃ³ö£¬ÒòΪËùν¾²Ì¬µÄÒâ˼£¬¾ÍÊǵØÖ·Öв»´øÎʺţ¬²»´øÎʺŵľÍÊǾ²Ì¬£¬¹ÜËûÊÇÕæµÄ»¹ÊÇαµÄ£¿ËÑË÷Òý
Çæ¿´µÃ³öÂð£¿ËùÒÔ˵£¬Æäʵ² ......
×òÌìÓöµ½ÁËÒ»¸öСÎÊÌâ,Ìá½»±íµ¥µÄʱºò,ºǫ́µÄactionÖÐÑéÖ¤µÄ±íµ¥ÀïµÄ¿Ø¼þÖµ¾ÓÈ»ÊÇ¿ÕÖµ,µ÷À´µ÷È¥²»µÃÆä·¨.
ÎÒÔÚǰ̨µÄ±íµ¥Àï¿Ø¼þÓõÄÊDZê×¼html¿Ø¼þ
Ò³ÃæÉÏʹÓÃÏÂÃæÓï¾ä·¢ËÍform
<%using (Html.BeginForm("AddNewPicGroups", "MetaData")){ %>
ºǫ́ʹÓÃÈçÏÂÓï¾ä½ÓÊÕʱȴ½ÓÊÕ²»µ½Êý¾Ý
public ActionResult AddNew ......
ÔÚÔçÆÚѧϰc#µÄ¹ý³ÌÖУ¬¾³£Óöµ½ÕâÑùµÄÓï¾ä£º
public string StudentName
{
get{return stuName;}
set{stuName=value;}
}
µ±Ê±Ò²²»ÊǺÜÃ÷°×ΪʲôҪÕâÑù£¿Ñ§ÉîÁËc#ºó£ ......
protected void Page_Load(object sender, EventArgs e)
...{
this.btnOK.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(btnOK, "Click") + ";this.disabled=true; this.value='Ìá½»ÖÐ...';");
}
//°´Å¥´¦Àí·½·¨
protected void btnOK_C ......