¶¨ÖÆASP.Net MVCµÄ´úÂëÄ£°å
ÔÚASP.Net MVCÀàÐ͵ÄÏîÄ¿ÖÐÓÒ»÷Controller Îļþ¼Ð£¬Ñ¡ÖÐAdd=>Controller¡ºó£¬»áÔÚн¨µÄController ÖвåÈëһЩĬÈÏ´úÂë¡£ ÔÚController µÄ¸÷¸öAction·½·¨ÖÐÓÒ»÷ Add View¡£¬Ò²»áÔÚн¨µÄViewÖвåÈëһЩ´úÂë¡£ÔÚн¨Viewʱ²åÈëµÄ´úÂë»á¸ù¾ÝÉÏÏÂÎĺÍÄãµÄÑ¡Ôñ¶ø²»Í¬£¬ËƺõÓкܴóµÄ´úÂëÉú³É¹¦ÄÜ¡£ ÉÏÊöÁ½ÕßÉú³É´úÂëʱ¶¼Óõ½ÁËVisual StudioµÄ T4 ´úÂëÉú³ÉÄ£°å£¬T4Ä£°åºÍCodesmithÄ£°åµÄÔÀí²î²»¶à¡£T4Ä£°åÉú³É´úÂ빦ÄÜÔç¾ÍÔÚVSÖÐÓÐÁË£¬Ö»ÊǺÜÉÙΪÈËËùÖª£¬ÕæÊÇVSµÄÒ»ÏîÒþ²Ø¹¦ÄÜ¡£ÒÔÉÏÁ½ÏÄÜʹÓõÄÄ£°å¶¼ÔÚC:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Web\MVC\CodeTemplates Ŀ¼Ï¡£ ½«CodeTemplatesµÄÕû¸öĿ¼¸´ÖƳöÀ´·ÅÈëÏîÄ¿Ï¡£ ÎÒÃÇ¿ÉÒÔÐÞ¸ÄÕâÀïµÄÄ£°å£¬Ò²¿ÉÒÔÌí¼Ó×Ô¼ºµÄÄ£°å£¬ÔÚÌí¼Ó´úÂëʱ¿ÉÒÔÑ¡ÔñÄĸöÄ£°å¡£ÕâÑù¾ÍʵÏÖÁ˶¨ÖÆASP.Net MVCµÄ´úÂëÄ£°å¡£
Ïà¹ØÎĵµ£º
string destFileName = "ok.txt";
destFileName = Server.MapPath(".") + "\\"+destFileName;
destFileName = Server.UrlDecode(destFileName);
&nbs ......
×÷Õߣºº®Óð·ã(cityhunter172)
Ðò
´úÂëд N ¾ÃÁË£¬×ÜÏëдµÃ±ðµÄ¡£Õâ²»£¬ÉÏͷ˵ÔÚÕûºÏÁ½¸öÏîÄ¿£¬×ö³Éµ¥Ò»µÇ¼£¨Single Sign On£©£¬Ò²ÓÐÈ˳Æ֮Ϊ“µ¥µãµÇ¼”¡£²éÔÄÏà¹ØÎĵµºó£¬ÖÕÓÚʵÏÖÁË£¬ÏÖÔÚ°ÑËüÄóöÀ´Óë´ó¼ÒÒ»Æð·ÖÏí¡£»òÐí´ó¼Ò»áÎÊ£º“ÕâÓë±êÌâ²»·ûѽ£¿”±ð¼±£¬ÔÚϱÊ֮ǰ£¬ÎÒÄÔ×ÓÀïÏëµ½ÁËÎÒ¸ÕʹÓà ......
1.Server.MapPath("/") //Ó¦ÓóÌÐò¸ùĿ¼ËùÔÚµÄλÖà Èç C:\Inetpub\wwwroot\
2.Server.MapPath("./") //±íʾËùÔÚÒ³ÃæµÄµ±Ç°Ä¿Â¼
//×¢£ºµÈ¼ÛÓÚServer.MapPath("") ·µ»Ø Server.MapPath("")ËùÔÚÒ³ÃæµÄ//ÎïÀíÎļþ·¾¶
3.Server.MapPath("../")//±íʾÉÏÒ»¼¶Ä¿Â¼
4.Server.MapPath("~/../");//±íʾ±¾ÎļþËùÔÚÎļþ¼ ......
1. Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯¡¡
¡¡
Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵͳ½«Óû§µÄÊý¾Ý¿âÁ¬½Ó·ÅÔÚÁ¬½Ó³ØÖУ¬ ......
ViewDataÓÐÒ»¸öModelStateµÄÊôÐÔ£¬ÕâÊÇÒ»¸öÀàÐÍΪModelStateDictionaryµÄModelStateÀàÐ͵Ä×ֵ伯ºÏ¡£ÔÚ½øÐÐÊý¾ÝÑéÖ¤µÄʱºòÕâ¸öÊôÐÔÊDZȽÏÓÐÓõġ£ÔÚʹÓÃHtml.ValidationMessage()µÄʱºò£¬¾ÍÊÇ´ÓViewData.ModelStateÖмì²âÊÇ·ñÓÐÖ¸¶¨µÄKEY£¬Èç¹û´æÔÚ£¬¾ÍÌáʾ´íÎóÐÅÏ¢¡£ÀýÈçÔÚǰһƪÎÄÕÂASP.NET MVC ÈëÃÅ7¡¢HellperÓëÊý¾ÝµÄÌá ......