³õʶ ASP.NET 3.5 MVC ¿ª·¢
ÔÚѧϰ±»Í£ÖÍÁËN¾ÃÒԺ󣬽ñÌìÖÕÓÚ϶¨¾öÐÄÒª¼ÌÐøÁË¡£¹ýÁËÌ«¾Ã¶éÂäµÄÉú»îÒ²¿ªÊ¼Ñá¾ëÁË¡£¼ÌÐø¿ªÊ¼ÎÒµÄMVCѧϰ֮·¡£ Ŀ¼»ú¹¹£º models Îļþ¼Ð£º Ä£ÐÍ×é¼þ »¹¿ÉÒÔ´æ·ÅÓйØÊý¾Ý·ÃÎʲÙ×÷µÄһЩÀà¡¢¶ÔÏóµÄ²Ù×÷µÄ¶¨ÒåµÈ¡£ Views Îļþ¼Ð£º ÊÓͼ×é¼þ¡£¿ÉÒÔ´æ·ÅµÄÎļþÀàÐÍ°üÀ¨.aspxÒ³Ã棬.ascx¿Ø¼þÒÔ¼°.masterĸ°æÒ³µÈ¡£ SharedÎļþ¼Ð£ºÊÓͼ×é¼þÖеĹ«Óò¿·Ö¡£¿ÉÒÔ´æ·Å ĸ°æÒ³¡¢CSSÑùʽµÈÎļþ¡£ ControllersÎļþ¼Ð£º¿ØÖÆÆ÷×é¼þ¡£ ÔÚWeb.ConfigÖÐ×¢²áÁË UrlRoutingModuleÀ࣬ÓÃÓÚ½âÎöURL·ÓÉ¡£
ÔÚGlobal.asaxÎļþÖеÄApplication_Start()·½·¨ÖÐÉèÖÃÁËURL·ÓÉ£¬ÒÔ¼°Ïà¹ØµÄ·ÓÉÂß¼¡£
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
}
}
Ö´Ðйý³Ì£º
µ±Ö´ÐлùÓÚASP.NET 3.5 MVC ¿ò¼ÜµÄMVCApplicationÍøվʱ£¬¸ù¾Ýä¯ÀÀÆ÷ÖеÄURLµØÖ·£¬¸ÃURLµØÖ·Ê×Ïȱ»´«µÝµ½URLRoutingModule Ä£¿é£¬¸ÃÄ£¿é½âÎö¸ÃURLµØÖ·£¬È»ºóÑ¡ÔñÏà¹ØµÄURL·ÓÉ£¬²¢µÃµ½¶ÒÏÖµÄIHttpContext¶ÔÏóÀ´´¦Àí¸ÃURL·ÓÉ¡£ÔÚĬÈÏÇé¿öÏ£¬¸ÃIHttpContext¶ÔÏó¾ÍÊÇMvcHandler ¶ÔÏó¡£Í¨¹ýMvcHandler¶ÔÏó£¬Ñ¡ÔñÏà¹ØµÄ¿ØÖÆÆ÷À´´¦ÀíÓû§µÄÇëÇó¡£
Ö´Ðв½Ö裺
ÔÚ»ùÓÚASP.NET 3.5 MVC ¿ò¼ÜµÄMVCApplicationÍøÕ¾ÖУ¬Ã¿Ò»¸öÇëÇóµÄÒ³Ã涼±»Ó³Éäµ½ÏàÓ¦µÄ¿ØÖÆÆ÷ÖеÄÏà¹Ø·½·¨£¬¿ØÖÆÆ÷¸ºÔð½«Öƶ¨µÄÄÚÈÝ·µ»Øµ½ä¯ÀÀÆ÷ÖС£¶à¸öÒ³Ãæ¿ÉÒÔ±»Ó³É䵽ͬһ¸ö¿ØÖÆÆ÷ÖеIJ»Í¬·½·¨¡£
ÔÚASP.NET 3.5 MVC¿ò¼ÜÖУ¬Ò³Ãæµ½¿ØÖÆÆ÷µÄÓ³ÉäÊÇͨ¹ý·¾¶±í£¨Route Table£©¶øʵÏֵģ¬¶ÔÓÚÿһ¸öÓ¦ÓóÌÐòÓÐÒ»¸ö·¾¶±í¡£Â·¾¶±íͨ¹ýRouteTable.Routes ÊôÐÔ±íʾ¡£
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
Ïà¹ØÎĵµ£º
ÍêÕû´úÂëÈçÏ£º02_ClientCentric.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="02_ClientCentric.aspx.cs" Inherits="ClientCentric" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="h ......
À´Ô´£ºhttp://www.code-123.com/html/2009917202320580.html
1.¸ú×ÙÒ³ÃæÖ´ÐÐ
ÉèÖöϵãÊÇÒ³Ãæµ÷ÊÔ¹ý³ÌÖеij£ÓÃÊֶΣ¬³ý´ËÖ®Í⣬»¹¿ÉÒÔͨ¹ý²é¿´Ò³ÃæµÄ¸ú×ÙÐÅÏ¢½øÐдíÎóÅŲéÒÔ¼°ÐÔÄÜÓÅ»¯¡£ASP.NETÖÐÆôÓÃÒ³Ãæ¸ú×ٷdz£·½±ã£¬Ö»ÐèÔÚPageÖ¸ÁîÖмÓÈëTrace="True"ÊôÐÔ¼´¿É£º
......
½«ViewState³Ö¾Ã»¯±£³ÖÔÚ·þÎñÆ÷¶ËÎļþµÄ´úÂ룬ÕâÑùViewState²»Õ¼ÓÃÍøÂç´ø¿í£¬Òò´ËÆä´æÈ¡Ö»ÊÇ·þÎñÆ÷µÄ´ÅÅ̶Áȡʱ¼ä¡£²¢ÇÒËüºÜС£¬¿ÉÒÔ˵ÊÇ´ÅÅÌËæ±ãתһȦ¾ÍÄÜͬʱ¶ÁÈ¡ºÃ¶àViewState£¬Òò´Ë¿ÉÒÔ˵“²»Õ¼Ê±¼ä”¡£ÎªÁËÔÙ“²»Õ¼´ÅÅÌʱ¼ä”£¬ÎÒ»¹Ê¹ÓÃÁË»º´æ¡£
´´½¨Ò»¸ö»ùÀà:
public class
BasePage : Sys ......
ASP.Net 1.1ºóÒýÈëÁ˶ÔÌá½»±íµ¥×Ô¶¯¼ì²éÊÇ·ñ´æÔÚXSS(¿çÕ¾½Å±¾¹¥»÷)µÄÄÜÁ¦¡£µ±Óû§ÊÔͼÓÃÖ®ÀàµÄÊäÈëÓ°ÏìÒ³Ãæ·µ»Ø½á¹ûµÄʱºò£¬ASP.NetµÄÒýÇæ»áÒý·¢Ò»¸ö HttpRequestValidationExceptioin¡£Ä¬ÈÏÇé¿öÏ»᷵»ØÈçÏÂÎÄ×ÖµÄÒ³Ã棺
ÒÔÏÂÊÇÒýÓÃƬ¶Î£º
Server Error in '/YourApplicationPath' Application
A potentially dangerou ......
ÔÎĵØÖ·:http://blog.csdn.net/ChengKing/archive/2009/01/01/3678774.aspx
ÊôÐÔµÄÉè¼ÆʱÌØÐÔ
.NET Framework
Ϊ
¿Ø¼þÉè¼ÆʱÊôÐÔÌṩÁ˺ܶà·á¸»µÄÀ࣬ÕâЩÊôÐԵŦÄܷdz£Áé»î£¬¿ØÖÆ·¶Î§¹ã·º£¬±ÈÈç¿ÉÒÔ¿ØÖƸÃÊôÐÔÔÚÊôÐÔ´°¿ÚÖеÄÏÔʾģʽ£¬È磺ÊÇ·ñÔÚÊôÐÔ´°¿ÚÖÐÏÔʾ¸ÃÊô
ÐÔ£¬Ò²¿ÉÒÔÖ¸¶¨´ËÊôÐÔ±ØÐë½ÓÊÕÖµÀàÐÍÃèÊö£¬°´×é· ......