΢ÈíÆóÒµ¿â5.0ѧϰ±Ê¼Ç£¨¾Å£©ASP.NET WEBÓ¦ÓóÌÐò
ÔÚASP.NET Web´°ÌåÓ¦ÓóÌÐòÖУ¬ÍƼöµÄ·½·¨Êǽ«ÈÝÆ÷´æµ½ÓÉApplication×Öµä¶ÔÏóÌṩµÄÈ«¾Ö״̬¡£µ±ÐèÒªµÄʱºòÄã¿ÉÒÔ·ÃÎÊÈÝÆ÷£¬ÉõÖÁʹÓÃHTTPÄ£¿é×Ô¶¯Íê³É¶ÔÒ³ÃæÉϿؼþµÄ×¢Èë¡£
ͨ³£Çé¿öÏ£¬ÄãÓ¦¸ÃʹÓÃApplication×Öµä¶ÔÏóÀ´´æ´¢ÈÝÆ÷µÄµ¥¸öʵÀý¡£Äú¿ÉÄܾö¶¨´´½¨Ö÷ÒªÈÝÆ÷µÄ×ÓÈÝÆ÷£¬²¢½«ËüÃÇ´æ´¢µ½Ã¿¸öÓû§µÄSession¶ÔÏóÖУ¬ÉõÖÁÊÇÿ¸öÇëÇó£¬ÔÚÕâЩ×ÓÈÝÆ÷ÖÐ×¢²á×Ô¶¨ÒåÀàÐͺÍÓ³Éä¡£µ«ÊÇ£¬Õâ¿ÉÄܽµµÍÓ¦ÓõÄÐÔÄÜ£¬Í¨³£Ó¦¾¡¿ÉÄܱÜÃâ´´½¨¶îÍâµÄÈÝÆ÷¡£
ASP.NETÓ¦ÓóÌÐòʵÀý»¯ÈÝÆ÷µÄ¼¼Êõ·½·¨¼°ÏÞÖÆ£º
1»ù±¾·½·¨¡£ÊʺÏСÏîÄ¿
2ÒÀÀµ×¢ÈëµÄÍƼö·½·¨¡£ÄÜÔÚÔËÐÐʱ×Ô¶¯Íê³É¶ÔÒ³Ãæ¿Ø¼þµÄ×¢Èë¡£
3£®ÏÞÖƺÍÌæ´ú;¾¶¡£
»ù±¾·½·¨
ͨ¹ýGlobal.asaxÎļþµÄApplication_StartʼþÀ´´´½¨²¢¹¹½¨ÈÝÆ÷¡£
protected void Application_Start(object sender, EventArgs e)
{
Application.Lock();
try
{
var myContainer = Application["EntLibContainer"] as IUnityContainer;
if (myContainer == null)
{
myContainer = new UnityContainer();
myContainer.AddExtension(new EnterpriseLibraryCoreExtension());
// Add your own custom registrations and mappings here as required
Application["EntLibContainer"] = myContainer;
}
}
finally
{
Application.UnLock();
}
}
ÒÀÀµ×¢ÈëµÄÍƼö·½·¨
ËäÈ»ÉÏÃæÌṩµÄ·½·¨ÎªÄã·ÃÎÊÈÝÆ÷ÌṩÁËÒ»ÖÖ;¾¶£¬µ«ÊÇ´æÔÚһЩÏÞÖÆ¡£ÕâÒâζ×ÅÄã±ØÐë±àд´úÂëÀ´´¦ÀíÄúÐèÒªµÄÀàµÄʵÀý£¬¶øÇÒ¼õÉÙÁË´úÂëµÄ¿É·¢ÏÖÐÔ£¨discoverability£©ºÍ¿É²âÐÔ¡£Èç¹ûÄãʹÓÃUnityÈÝÆ÷£¬ÄÇôһ¸ö¸üºÃµÄ·½·¨¾ÍÊÇͨ¹ýÈÝÆ÷µÄÿ¸öÇëÇó¶¼Ê¹ÓÃBuildUp·½·¨À´¹¹½¨ÒÀÀµ¡£ÕâÒâζ×ÅÄãÖ»ÐèÒª¹ØÐÄÄãµÄ¿Õ¼äºÍÀàµÄÓ¦ÓúÏÊʵÄÊôÐÔ£¬»ò×ÅÔÚÈÝÆ÷ÖÐÅäÖÃ×¢Èë×¢²áºÍÓ³Éä¡£ÔÚÔËÐÐʱעÈëÐèÒªµÄÆóÒµ¿â¶ÔÏóºÍÄã×Ô¼ºµÄÀà¡£
Ò»ÖÖ·½·¨ÊÇ´´½¨HTTPÄ£¿éµ±Ò»¸öÒ³Ãæ¼ÓÔصÄʱºò×Ô¶¯ÎªËùÓÐÒÀÀµ´´½¨×¢È롣ΪÁË×öµ½ÕâÒ»µã£¬ÄãÐèÒªÒ»¸öHTTPÄ£¿éÔÚÒ³Ãæ³õʼ»¯Ö´Ðйý³ÌÖÐÖ´ÐдúÂ룬ÒÔÌî³äÒÀÀµ¡£»¹¿ÉÒÔʹÓÃGlobal.asaxÖеÄApplication_Start·½·¨µÄÀ´´´½¨ºÍÌî³äÈÝÆ÷£¬ÀàHttpApplicationStateµÄÒ»¸öÀ©Õ¹·½·¨½«ÈÝÆ÷±©Â¶¸øÓ¦ÓóÌÐò´úÂë.Ò»µ©´´½¨ÁËÕâЩ£¬Ö»ÐèÒªÓ¦ÓÃÅäÖÃÖеÄÒ»ÐпÉʹÄãÓ¦ÓÃÖеĿؼþºÍÀàÄܹ»×Ô¶¯ÒÀÀµ×¢Èë¡£
Ϊ×Ô¶¯ÒÀÀµ×¢Èë×¼±¸Ò»¸öASP.NETÓ¦ÓÃ
1.ÔÚ¹¤³ÌÖд´½¨Ò»¸öеÄASP.NE
Ïà¹ØÎĵµ£º
1.<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
Vs2005ºìÉ«ÁË£¬ÌáʾÕÒ²»µ½¸ÃÎļþ
ÓÚÊǸÄΪ.<script src="/Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
½á¹ûºìɫûÓÐÁË£¬µ«ÊDZàÒëʱ±¨´í£¬ÕÒ²»µ½¸ÃÎļþ
½áÂÛ£º<script src="Script ......
´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
´«ËͲÎÊý£º
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="++"')
</script>")
½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1.Attributes.Add("oncl ......
//postÇëÇó
string name = Request["name"].toString();
string name =Request.Form.Get("name").toString();
//getÇëÇó
string name = Request.QueryString["name"].toString();
µ«ÎÒ·¢ÏÖ ÎÞÂÛÊÇ·ñÊÇpostÓëget´«Öµ¶¼¿ÉÓÃ
string name = Request["name"].toString();
±íµ¥Ìá½»ÖÐgetºÍpost·½Ê½µÄÇø±ð¹éÄ ......
ÔÚweb³ÌÐòÖУ¬¾³£»áʹÓÃÔÚÒ»¸öÍøҳʹÓÃÆäËûÍøÒ³Ìá½»µÄÊý¾ÝÐÅÏ¢£¬ÕâÀï¿ÉÒÔʹÓÃRequestÄÚÖöÔÏóÀ´Íê³É£¬À´»ñÈ¡Óû§Ìá½»µÄÐÅÏ¢£¬¸ù¾Ý¿Í»§¶ËÌá½»Êý¾Ý·½Ê½µÄ²»Í¬£¬Request¶ÔÏó·Ö±ðʹÓÃFormºÍQueryString¼¯ºÏÊôÐÔÀ´»ñÈ¡Êý¾Ý¡£ÏÂÃæÊÇÁ½ÖÖ¼¯ºÏ»ñÈ¡·½Ê½µÄ²»Í¬µã£ºÍ¨¹ýForm»ñÈ¡Êý¾ÝʱÔÚformÊôÐÔÖмòµ¥µÄÌí¼Óaction=“ÌøתµÄÍøÒ³ ......
ÔÚ×öWEBϵͳ¿ª·¢Ê±£¬Ã¿Ã¿Óöµ½Ò³Ãæ´«ÖµµÄÎÊÌⶼÊÇÔÚʹÓÃ×î¼òµ¥µÄGET·½Ê½À´´«Öµ£¬Èç¹ûÐÅÏ¢Á¿±È½ÏÉÙ²¢ÇÒÓÖ²»Éæ¼°°²È«ÎÊÌâµÄ»°
»¹¿ÉÒÔÓ¦¸¶Ò»Ï£¬µ«ÊÇ´«µÝ´óÁ¿Êý¾Ý¡¢Ãô¸ÐÊý¾ÝµÄʱºò.....
ÏÂÃæ¾ÍASP.NETÖÐÒ³Ãæ´«Öµ·½Ê½×ö¸ö»ã×Ü£¬ÒÔ±¸²»Ê±Ö»Ðè
1¡¢GET´«Öµ·½Ê½
·¢ËÍÒ³Ã棺
  ......