ÐÂÊÖ¸ú×ÅѧAsp.net MVC2 Controller
ÉÏ´ÎÎÒÃÇ˵µ½ÁË route ·ÓɵŦÄÜ,Õû¸ömvcÔËÐйý³Ì:
Route(·ÓÉ) --> Controller(¿ØÖÆÆ÷)-->action(·½·¨)
Õâ´ÎÎÒÃÇҪ˵µÄ¾ÍÊÇ controller ¿ØÖÆÆ÷ ºÍ action£º
¿ØÖÆÆ÷µÄ×÷ÓþÍÊÇ£ºµ±Ò»¸ö Request À´µÄʱºò£¬Ê×ÏÈRoute ½âÎö ÕÒµ½ÁË ¶ÔÓ¦ ¿ØÖÆÆ÷£¬¿ØÖÆÆ÷ÔÙ¸ù¾Ý action ¾ö¶¨¸øÎÒÃÇ·µ»ØʲôÑùµÄÄÚÈÝ¡£È磺
´úÂë
public class MyControllerController : Controller
{
public ActionResult MyAction(DateTime dt)
{
ContentResult cr = new ContentResult();
cr.Content = "MyController's MyAction is Workded!" + dt.ToString("yyyyÄêMMÔÂddÈÕ");
return cr;
}
public void MyTest()
{
Response.Write("hhhh");
}
}
Ê×ÏÈ£º ¿ØÖÆÆ÷Àà ±ØÐë¼Ì³Ð Controller£¬Õâ¸öÎÒÃÇн¨controller µÄʱºò ¶¼ÒѾ¸øÎÒÃǼ̳кÃÁË£¬ÕâÀïÎÒÃÇÆðÁËÒ»¸öÃû×ֽГMyController”£»
ÕâÀï¿ØÖÆÆ÷ÃüÃû¹æÔò ×îºóÐèÒªÊÇController£¬È磺TestController……
Õâ¸ö¿ØÖÆÆ÷ÀïÃæÎÒÃÇдÁË2¸ö·½·¨£¬Ê×ÏȵÚÒ»¸ö MyAction£¬½ÓÊյIJÎÊýÊÇ DateTimeÐ굀 dt£¬ÕâÀïÎÒÃǵÚÒ»¸ö±Ê¼ÇÒѾ˵µ½ÁËurl ¹æÔòÀïÃæµÄ {dt}²ÎÊý£¬ÕâÀïÎÒÃÇÕâÑù½ÓÊÕµ½ÎÒÃÇurlÀïÃæËù´«µÝµÄ²ÎÊý;·µ»ØÀàÐÍÊÇ ActionResult£¬·µ»ØÀàÐÍÓкü¸ÖÖÈ磺
ViewResult:Ò»°ã³ÊÏÖij¸öaspxÎļþ£¬ÓÉView·½·¨·µ»Ø¡£
RedirectToResult:ʹä¯ÀÀÆ÷Öض¨Ïò£¬ÓÉRedirect·½·¨·µ»Ø¡£
RedirectToRouteResult:Ö±½Ó½»¸øÏÂÒ»¸öAction£¬ÓÉRedirectToAction·½·¨·µ»Ø¡£
ContentResult:ÒÔÎÄ×ÖÐÎʽ·µ»Ø
ÉÏÃæÊdz£Óõļ¸Ö
Ïà¹ØÎĵµ£º
protected void Page_Load(object sender, EventArgs e)
{
}
#region OnPreInit µÚÒ»²½
protected override void OnPreInit(EventArgs e)
{
//¼ì²é ......
ÀýÒ»£º
+++ µÚÒ»¸öÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
<div>
<a href="QueryString04.aspx?blog=DoooooNetooooot.blog.tianya.cn&qq=516535763">³¬Á´½Ó´«ÖµÊ¾Àý</a>
</div>
++ ºǫ́´úÂëÈçÏ£º
(ÂÔ)
+++ µÚ¶þ¸öÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
(ÂÔ)
++ ºǫ́´úÂëÈçÏ£º
protected void Page_Load( ......
ASP.NET AJAXÈëÃÅϵÁн«»áд¹ØÓÚASP.NET AJAXһЩ¿Ø¼þµÄʹÓ÷½·¨ÒÔ¼°»ù´¡ÖªÊ¶£¬ÆäÖв¿·ÖÎÄÕÂΪԴ´£¬Ò²ÓÐһЩÎÄÕÂÊÇÖ±½Ó·Òë×Ô¹Ù·½Îĵµ£¬±¾²¿·ÖÄÚÈݻ᲻¶Ï¸üС£
Ŀ¼
ASP.NET AJAXÈëÃÅϵÁУ¨1£©£º¸ÅÊö
µ¼¶Á£º×÷Ϊ±¾ÏµÁÐÎÄÕµĿªÆª£¬¼òµ¥½éÉÜÒ»ÏÂASP.NET AJAXµÄ¸Å¿ö¼°¸÷¸ö×é³É²¿·Ö¡£
......
Äú¿ÉÒÔʹÓÃHTTPÄ£¿é£¬Ò»¸öµ½ASP.NET HttpApplicationStateÀàµÄÀ©Õ¹£¬ÔÚGlobal.asax±àд´úÂëÇ¿ÖÆASP.NETÔÚÿһ¸öÒ³ÃæÇëÇóʱ×Ô¶¯×¢ÈëÒÀÀµµÄ¶ÔÏ󣬾ÍÏñÔÚASP.NET Web´°ÌåÓ¦ÓóÌÐòÖÐÌÖÂÛµÄÒ»Ñù.
ÏÂÁз½·¨ÏÔʾÁËÒ»¸öºÏÊʵķ½·¨Äܹ»»ñÈ¡PreRequestHandlerExecuteʼþ½«Ëü×Ô¼º×¢Èëµ½ASP.NE ......
ÒýÓÃ×Ô£ºhttp://www.cnblogs.com/suzongwei/archive/2008/11/10/1330377.html
»òÐí Õâ¸ö¸üÒ׶®Ð© ´úÂë¹ý³Ì
http://blog.csdn.net/swort_177/archive/2007/12/02/1912159.aspx
¶ÔÓÚASP.NET¿ª·¢Õߣ¬Àí½âASP.NETµÄÒ³ÃæÉúÃüÖÜÆÚÊǷdz£ÖØÒªµÄ¡£
Ö÷ÒªÊÇΪÁ˸ãÃ÷°×ÔÚÄÄÀï·ÅÖÃÌض¨µÄ·½·¨ºÍÔÚºÎʱÉèÖø÷ÖÖÒ³ÃæÊôÐÔ¡£
µ«ÊǼÇÒäºÍ ......