ÔÚ ASP.NET MVC ÏîÄ¿ÖÐʹÓà WebForm
ASP.NET MVCºÍWebForm¸÷Óи÷µÄÓŵ㣬ÎÒÃÇ¿ÉÄÜÐèҪͬʱʹÓÃASP.NET MVCºÍWebForm¡£±¾ÎĽéÉÜÁËÈçºÎÔÚASP.NET MVCÏîÄ¿ÖÐʹÓÃWebForm¡£
Ê×ÏÈн¨Ò»¸öÃûΪWebFormsµÄÎļþ¼ÐÓÃÓÚ´æ·ÅWebForm£¬²¢Ìí¼ÓÒ»¸öWeb´°ÌåÎļþDemo.aspx×÷ΪÑÝʾ¡£
Demo.aspx¾Í¼òµ¥µÄÊä³öÒ»¾ä»°“It’s a WebForm.”
¹Ø¼ü²½ÖèÔÚÓÚ·ÓÉÉèÖá£Èç¹ûÄãÏ£ÍûWebFormsÕâ¸öÎļþ¼ÐÃû×÷ΪURLµÄÒ»²¿·Ö£¬Ò²¾ÍÊÇÆÕͨWebFormÓ¦ÓóÌÐòµÄ·½Ê½À´·ÃÎÊÕâ¸öDemo.aspx£¬ÄÇôֻÐèÒª¼òµ¥µÄºöÂÔÕâ¸ö·ÓɹæÔò¼´¿É¡£
ÔÚGlobal.asax.csÎļþµÄRegisterRoutes·½·¨ÖмÓÈëÒÔÏ´úÂë
// ºöÂÔ¶Ô WebForms ·¾¶µÄ·ÓÉ
routes.IgnoreRoute("WebForms/{weform}");
½á¹û£º
Èç¹ûÏ£ÍûURL¸üÓѺûòÕß²»³öÏÖWebFormsÕâ¸öÎļþ¼ÐÃû£¬ÄǾÍÒª×Ô¼ºÐ´Ò»¸öÀà¼Ì³ÐIRouteHandler¡£
public class WebFormsRouteHandler:IRouteHandler
{
private string pageName = string.Empty;
public WebFormsRouteHandler(string page)
{
this.pageName = page;
}
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
// ´´½¨ÊµÀý
IHttpHandler hander = BuildManager.CreateInstancefromVirtualPath("/WebForms/" + this.pageName, typeof(System.Web.UI.Page)) as IHttpHandler;
return hander;
}
}
È»ºóÔÚGlobal.asax.csÎļþÖмÓÉÏеķÓɹæÔò
routes.Add("webforms", new Route("web/demo", new WebFormsRouteHandler("demo.aspx")));
µ±Â·¾¶Æ¥Åäweb/demoʱÓÃ×Ô¶¨ÒåµÄÀàÀ´´¦ÀíÕâ¸öÇëÇó¡£
½á¹û£¨URL¸Ä±ä£©£º
Ïà¹ØÎĵµ£º
public static bool AddTbmember(Tbmember member, string regip)
{
bool check = false;
try
{
SqlCommand sqlcommnad = new SqlCommand("Pro_AddUsers", sqlconn.GetConn());
sqlcommnad.CommandType = CommandType.StoredProcedure; ......
Ò»¡¢
Js
ÉèÖÃĬÈÏ°´Å¥
function
document.onkeydown()
{
var
e=event
.srcElement;
&nbs ......
×î½üÕýÔÚ×öÒ»¸ö±¨±í³ÌÐò£¬Ò²¾ÍÊÇÀûÓÃÒѾÓеı¨±íÄ£°å£¬½«Êý¾Ý¿âÀïµÄÊý¾ÝÌî³ä½øÈ¥ºó£¬¿Í»§¶Ë¿ÉÒÔÏÂÔØ¡£
»ù±¾Ë¼ÏëÊÇÕâÑùµÄ£º1.ÔÚ·þÎñÆ÷¶Ë±¾µØн¨Ò»¸öÎļþ¼Ð£¬×¨ÃÅÓÃÀ´´æ·ÅÁÙʱµÄExcel±í¸ñ
& ......
×îÖÕЧ¹ûÈçÏÂͼ£º
-----------------------------------------------------------------------------------------------
Ñùʽ²¿·Ö£º
<style type="text/css">
.anpager .cpb
{
& ......
ASP.NET Òì³£´¦Àí
ÔÚ
Asp.net
¿ª·¢¹ý³ÌÖУ¬ÎÒÃÇ»áÓöµ½ºÜ¶à
Exception
£¬²»´¦ÀíÕâЩ
Exception
µÄ»°»á³öÏÖºÜÄÑ¿´µÄÒ³Ãæ¡£
»¹ÓÐһЩÎÒÃÇδԤÁϵ½µÄ
Exception
£¬µ±·¢Éú
Exception
ʱ£¬ÎÒÃÇÒ²±ØÐë½øÐмǼ¾ßÌåλÖã¬ÒÔ±ãÎÒÃÇÐÞÕý´íÎó¡£
asp.net
Òì³£´¦ÀíµÄλÖôó¸ÅÓÐÒÔÏÂ
3
¸öµØ·½
1.
³ÌÐòµÄ´úÂë¶ÎÖУ¬ÕâÊÇ× ......