ASP.netÒ³ÃæÌøת·½Ê½±È½Ï
1 response.redirect Õâ¸öÌøתҳÃæµÄ·½·¨ÌøתµÄËٶȲ»¿ì£¬ÒòΪËüÒª×ß2¸öÀ´»Ø£¨2´Îpostback£©£¬µ«Ëû¿ÉÒÔÌøתµ½ÈκÎÒ³Ã棬ûÓÐÕ¾µãÒ³ÃæÏÞÖÆ£¨¼´¿ÉÒÔÓÉÑÅ»¢Ìøµ½ÐÂÀË£©£¬Í¬Ê±²»ÄÜÌø¹ýµÇ¼±£»¤¡£µ«ËÙ¶ÈÂýÊÇÆä×î´óȱÏÝ£¡redirectÌøת»úÖÆ£ºÊ×ÏÈÊÇ·¢ËÍÒ»¸ö httpÇëÇ󵽿ͻ§¶Ë£¬Í¨ÖªÐèÒªÌøתµ½ÐÂÒ³Ã棬Ȼºó¿Í»§¶ËÔÚ·¢ËÍÌøתÇëÇóµ½·þÎñÆ÷¶Ë¡£ÐèҪעÒâµÄÊÇÌøתºóÄÚ²¿¿Õ¼ä±£´æµÄËùÓÐÊý¾ÝÐÅÏ¢½«»á¶ªÊ§£¬ËùÒÔÐèÒªÓõ½session¡£
2 server.transfer Ëٶȿ죬ֻÐèÒªÒ»´Îpostback ,µ«ÊÇ¡£¡£¡£¡£Ëû±ØÐëÊÇÔÚͬһ¸öÕ¾µãÏ£¬ÒòΪËüÊÇserverµÄÒ»¸ö·½·¨¡£ÁíÍ⣬ËûÄÜÌø¹ýµÇ¼±£»¤¡£Äã¿ÉÒÔд¸öС³ÌÐòÊÔÊÔ£ºÉè¼ÆÒ»¸öÓÉÒ³ÃæÒ»µ½Ò³Ãæ¶þµÄÌøת£¬µ«Òª½øÈëµ½Ò³Ãæ¶þÐèÒªµÇ¼£¬formÈÏÖ¤£¬µ«Èç¹ûÌøתÓï¾äʹÓÃtransferµÄ»°£¬ÄǾͲ»»áµ¯³öµÇ¼ҳÃæÁË¡£Õâ¸ö·½·¨µÄÖض¨ÏòÇëÇóÊÇ·¢ÉúÔÚ·þÎñÆ÷¶Ë£¬ËùÒÔä¯ÀÀÆ÷µÄurlµØÖ·ÈÔÈ»±£ÁôµÄÊÇÔÒ³ÃæµÄµØÖ·£¡
3 sever.execute Õâ¸ö·½·¨Ö÷ÒªÊÇÓÃÔÚÒ³ÃæÉè¼ÆÉÏÃ棬¶øÇÒËû±ØÐëÊÇÌøתͬһվµãϵÄÒ³Ãæ¡£Õâ¸ö·½·¨ÊÇÐèÒª½«Ò»¸öÒ³ÃæµÄÊä³ö½á¹û²åÈëµ½ÁíÒ»¸öaspxÒ³ÃæµÄʱºòʹÓ㬴󲿷ÖÊÇÔÚ±í¸ñÖУ¬½«Ä³Ò»¸öÒ³ÃæÀàËÆÓÚǶÌ׵ķ½Ê½´æÔÚÓÚÁíÒ»Ò³Ãæ¡£
×ܽ᣺
µ±ÐèÒª°ÑÓû§Ìøתµ½Áíһ̨·þÎñÆ÷ÉϵÄÒ³ÃæµÄʱºò ʹÓÃredirect
µ±ÐèÒª°ÑÓû§Ìøתµ½·ÇaspxÒ³Ãæʱºò£¬Èçhtml ʹÓÃredirect
ÐèÒª°Ñ²éѯ×Ö·û´®×÷ΪurlÒ»²¿·ÖµÄʱºò±£Áô´«¸ø·þÎñÆ÷µÄʱºò£¬ÒòΪÆäËû2ÖÖ·½·¨²»ÄÜ×öµ½2´Îpostback£¬°ÑÊý¾ÝÏÈ´ø»Ø·þÎñÆ÷ ʹÓÃredirect
ÐèÒªaspxÒ³Ãæ¼äµÄת»»£¨²»Éæ¼°µÇ¼£© ʹÓÃtransfer
µ±ÐèÒª°ÑaspxÒ³ÃæµÄÊä³ö½á¹û²åÈëµ½ÁíÒ»¸öaspxÒ³ÃæµÄʱºòʹÓà execute·½·¨¡£
µ±È»£¬Íü¼ÇÁË»¹ÓÐÒ»¸ö³¬Á´½Ó£¡µ±È»Õâ¸ö¾Í²»ÐèÒª½²Ì«¶àÁË¡£ËûÊÇÔÚµ³ÐèÒªÓû§À´¾ö¶¨Ê²Ã´Ê±ºòÌøתҳÃ棬¾ÍʹÓó¬Á´½Ó¡£
˳±ãÌáһϣ¬ÈçºÎʹÓÃredirect·½·¨ÔÚ²éѯ×Ö·û´®ÖÐʹÓúº×Ö£¬ÒòΪ¾³£µÄÇé¿öÊdzöÏÖÂÒÂ룬ÔÒòÊÇurl²»Ö§³Öºº×Ö¡£Õâ¸öʱºòÐèҪת»»£º
string message =server.urlencode("»¶ÓÀ´µ½ÈüÅÜרÀ¸");
ÏÈת»»£¬ÔÚʹÓòéѯ×Ö·û´®
response.redirect("webform2.aspx?msg="+message);
asp.netʵÏÖ´ÓÒ»¸öÒ³ÃæÌøתµ½ÁíÒ»Ò³Ãæ·½·¨µÄ±È½Ï
ʵÏÖÒ³ÃæÌøתµÄ·½·¨ºÜ¶à£¬³ýÁË·þÎñÆ÷¿Ø¼þÊÇasp.net·â×°¹ýÍ⣬ÆäËüÔÚaspÖÐÒ²¾ÍÓÐÁË¡£
Õâô¶àʵÏÖ·½·¨ÖУ¬¶¼ÊÇʵÏÖͬÑùµÄ¹¦ÄÜ£¬ÎªÊ²Ã´»¹ÒªÖ§³ÖÈç´Ë¶àµÄ·½·¨ÄØ£¬ÎÒÃÇʵ¼ÊÓ¦ÓÃ
Öе½µ×Ó¦¸ÃÑ¡ÔñÄÄÒ»ÖÖ·½·¨ÄØ£¿Ò²ÐíÎÒÃÇ´ó¶àÊýÈ˶¼ÊÇÐèÒªÓÃÌøתʱ£¬Ëæ±ãÏëµ½Ò»¸ö±ãÄÃÀ´Óã¬
´Ó²»È¥¿¼ÂÇËüÃ
Ïà¹ØÎĵµ£º
Application
1.ApplicationÓÃÀ´±£´æËùÓÐÓû§¹²ÓõÄÐÅÏ¢
2.ÔÚAspʱ´ú£¬Èç¹ûÒª±£´æµÄÊý¾ÝÔÚÓ¦ÓóÌÐòÉú´æÆÚÄÚ²»»á»òÕߺÜÉÙ·¢Éú¸Ä±ä£¬ÄÇôʹÓÃApplicationÊÇÀíÏëµÄÑ¡Ôñ¡£µ«ÊÇÔÚAsp.net¿ª·¢»·¾³ÖÐÎÒÃÇ°ÑÀàËƵÄÅäÖÃÊý¾Ý·ÅÔÚWeb.configÖС£
3.Èç¹ûҪʹÓÃApplication ҪעÒâµÄÊÇËùÓеÄд²Ù×÷¶¼ÒªÔÚApplication_OnStartʼþÖÐÍê³É ......
ÔÚʹÓÃAJAX½øÐгÌÐò¿ª·¢µÄʱºò£¬Ò»Ö±¶¼»áÃæ¶ÔÒ»¸ö»º´æµÄÎÊÌ⣡£¡
¼´ÊÇ£¬ÉÏ´ÎÇëÇóµÄʱºò£¬ÒòΪÄãµÄSQLÓï¾ä»òÕßÆäËûÔÒò£¬webserviceÖзµ»ØֵΪ¿Õ£¬²»ÊÇÄãÏëÒªµÄ½á¹û¼¯£¬ÔÚÄã·¢ÏÖwebserviceÖÐÓï¾äÌå³ö´íºó£¬½øÐÐÐ޸ģ¬ÖØвâÊÔ£¬ÈÔÈ»ÊÇÉϴεķµ»Ø½á¹û£¡¸Ð¾õ¾ÍÏñÄãµÄÐÞ¸ÄÍêÈ«ÎÞЧ¡£¡£
Æäʵ£¬ÕâÊÇÔÚAJAXµ ......
/// <summary>
/// ¹ýÂ˱ê¼Ç
/// </summary>
/// <param name="NoHTML">°üÀ¨HTML£¬½Å±¾£¬Êý¾Ý¿â¹Ø¼ü×Ö£¬ÌØÊâ×Ö·ûµÄÔ´Âë </param>
/// <returns>ÒѾȥ³ý±ê¼ÇºóµÄÎÄ×Ö</returns>
&nbs ......
ÎÒÊÔ×ÅȥʹÓÃasp.net mvcÄ£°åÈ¥´´½¨Ò»¸öblog·¢²¼ÏµÍ³¡£µ±È»£¬ÍøÉÏÓкܶàopen sourceµÄÄã¿ÉÒÔʹÓã¬ÌرðÊǺܶàphpдµÄÄ£°å¡£
ÕâÀïÖ»ÊÇÈ¥ÊÔ×ÅѧϰʹÓÃasp.net mvcÄ£°åÈ¥´´½¨Ò»¸öblog·¢²¼ÏµÍ³£¬ÎÒ×Ô¼ºÓᣴ󲿷ֵÄblog¶¼»áÓÐÈçÏÂһЩ²¿·Ö×é³É£º
ÕâÀﻹ»áʹÓÃCommon Library .net Õâ¸öopen sourceµÄproject¡£Äã¿ÉÒÔµ½ ......
ûÓÐ×ÐϸÑо¿¹ýViewState£¬×î½ü³öÏÖµÄÎÊÌâÈÃÈËÍ·Í´²»ÒÑ¡£
ViewState»áÔÚijЩÌض¨Çé¿öÏÂÏûʧ£¬ÇÒºÜÄѲ¶×½µ½¡£²éÁËһЩ¼¼ÊõÎÄÕ£¬¶¼ÊÇ˵ViewStateµÄ»úÖÆÊǽ«ÐÅÏ¢´æÔÚÒ³ÃæµÄhidden inputÀïÃ棬Ëƺõ²»¿ÉÄÜ´æÔÚÕâЩÎÊÌ⣬¸ø³öµÄÀíÓÉÎÞ·ÇÊÇÔÚij¸öµØ·½±»Ä³¸ö²»Ð¡ÐĵijÌÐòÔ±¸ø½ûµô»òÇå³ýµôÁ ......