asp.net ÏÂʵÏÖÎļþÉÏ´«½ø¶ÈÌõ£¨IHttpModule£©
±¾ÎĽ«Ì½ÌÖasp.netÏÂʵÏÖÎļþÉÏ´©½ø¶ÈÌõµÄ·½·¨¡£
Ò»°ãÇé¿öÏ£¬ÒªÊµÏÖÉÏ´«½ø¶ÈÌõÊ×ÏÈҪʵÏÖÉÏ´«Îļþ·Ö¿é¶ÁÈ¡£¬¶øĬÈÏÇé¿öÏ£¬iis½«Ö±½Ó°ÑÉÏ´«µÄÎļþÒ»´Î¶ÁÈëµ½ÄÚ´æÖУ¬ËùÒÔ±¾´¦µÄÄѵãÔÚÓÚÀ¹½ØiisµÄÎļþÉÏ´«¹ý³Ì£¬×ª¶ø×Ô¼ºµÄʵÏÖ·½Ê½¡£ËùÒÔ£¬ÎÒÃÇ¿ÉÒÔʵÏÖÒ»¸öIHttpModuleÀ´´¦ÀíÉÏ´«¹ý³Ì¡£¾ßÌåµÄ¹ý³ÌÊÇApplication_BeginRequestϵõ½µ±Ç°µÄHttpWorkRequest£¬È»ºóͨ¹ýÕâ¸ö¶ÔÏóÀ´µÃµ½µ±Ç°ÇëÇóµÄÀàÐÍ£¬³¤¶È¡£¾ßÌå·½·¨Çë²é¿´ÀàµÄʵÏÖ´úÂ루¸ÃÀàÀ´×ÔÓÚ»¥ÁªÍø£©¡£
ÓÉÓÚÔÚÀàÖÐÒѾÓбȽÏÍêÕûµÄ×¢ÊÍ£¬ËùÒÔÎÒÖ»½éÉÜÒ»¸öÁ÷³Ì£¬Ã»ÓÐÉæ¼°µ½¾ßÌåµÄ·½·¨¡£
ÎÒÃÇ¿ÉÒÔÖªµÀ£¬Èç¹ûÎÒÃÇÈ¡µÃÁË×ܵij¤¶È£¬ÄÇÎÒÃǾͿÉÒÔÉèÖÃÒ»¸ö¹Ì¶¨µÄ³¤¶È£¨±ÈÈç1024×Ö½Ú£©£¬È»ºóÉèÖÃÒ»¸öÑ»·À´Ã¿´Î¶ÁÈ¡ÕâЩÊý¾Ý£¬ÕâÑù£¬ÎÒÃǾͿÉÒԵõ½µ±Ç°×ܹ²¶ÁÈ¡µÄÄÚÈݳ¤¶È¡£ÄÇÒ³ÃæÉÏÈçºÎµÃµ½µ±Ç°µÄ½ø¶ÈÄØ£¿ÀûÓÃappliaction¶ÔÏóÀ´´æ´¢Êý¾Ý£¬ÕâÑù£¬Ç°Ì¨µÄÒ³ÃæÒ²¿ÉÒÔʹÓÃapplicationÀ´µÃµ½µ±Ç°µÄ½ø¶È¡£ÒòΪapplicationҪʹÓÃÒ»¸ö¼üÀ´È·¶¨ÊÇÄĴεÄÊý¾Ý£¬³£Óõķ½·¨ÊÇ£¬ihttpmoduleÖÐͨ¹ýrequestÀ´È¡µÃÕâ´ÎµÄ¼üÖµ£¬¶øÉÏ´«ÎļþҲͬÑùÓµÓÐÕâÑùÒ»¸ö¼üÖµ¡£Òò´ËÔÚupload.aspxÖеÄpage_loadÖÐÐèÒª£º
this.UploadID = this.Request["UploadID"];
if (this.UploadID == null)
this.Response.Redirect("~/user/uploadphotos.aspx?UploadID=" + Guid.NewGuid().ToString()+
"&itemid="+this.itemid.ToString (), true);
Èç¹ûµÚÒ»´Î½øÈ룬¾ÍÖØÐÂת·¢µ½ÕâÕÅÒ³Ã棬²¢¸øËûÒ»¸öuploadid£¬Í¬Ê±ÔÚHttpUploadModuleÖУº
string uploadId = app.Request.QueryString["UploadID"];//ͬ²½È¡µÃÕâ¸öuploadid
ÄÇÈçºÎÀ´ÊµÊ±¶ÁÈ¡Õâ¸öÊý¾Ý²¢ÏÔʾÔÚÒ³ÃæÖÐÄØ£¿
ÎÒÃÇ¿ÉÒÔÔÚupload.aspxÖÐʹÓÃxmlhttpȥѻ·ÇëÇóÒ»¸öprogress.aspx£¨Õâ¸öÒ³ÃæÀ´¶ÁÈ¡applicationÖеÄÊý¾Ý£©¡£
µ±È»£¬ÔÚasp.netÖÐÎÒÃÇ»¹¿ÉÒÔʹÓÃasp.net ajaxÀ´ÊµÏÖÕâÒ»¹ý³Ì£¬¾ßÌå·½·¨ÊÇ£º
½¨Á¢Ò»¸öwebservicesÀ´¶ÁÈ¡applicationÖеÄÊý¾Ý£»
ÔÚajaxÖÐÀ´·ÃÎÊÕâ¸öservice£»
ÈçÏÂwebservices¶Ë´úÂ룺
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using adow.adup.
Ïà¹ØÎĵµ£º
“<%#....%>” ÕâÊÇÊý¾Ý°ó¶¨£¬ÀïÃæ¿ÉÒÔµ÷ÓÃC#µÄ·½·¨¡£
“<%$....%>" û¼û¹ýÕâ¸ö¡£
“<%@...%>”Õâ¸öÊÇÒ³ÃæÖ¸Áһ°ã·ÅÔÚÿ¸öÒ³ÃæµÄ×²¿£¬¶ÔÒ³ÃæµÄÔËÐнøÐпØÖÆ£¬ÈçÉèÖûº´æ£¬ÒýÓÃÓû§¿Ø¼þ£¬µ¼ÈëÃüÃû¿Õ¼ä==
ÁíÍ⻹ÓÐÒ»¸ö<%= ...%> Õâ¸ö=ºÅºóÒ²¿ÉÒÔµ÷ÓÃC#µÄ·½· ......
<system.web>
<!--********³ö´íÒ³µÄÉ趨********-->
<customErrors mode="On" defaultRedirect="~/Error.htm"> </customErrors> ......
н¨Ò»¸öĬÈϵÄASP.NET MVC2Ó¦ÓóÌÐò£¬ÏµÍ³»áĬÈϵÄÉú³É°üº¬»ù±¾¹¦ÄܵÄÓ¦ÓóÌÐò£¬²é¿´ÕâЩÉú³ÉµÄ´úÂ룬¿É°ïÖúÎÒÃÇÀí½âASP.NET MVC2¡£ÏÂÃæÊǶÔURL·ÓɵÄÀí½â£¬ÒÔ±¸Íü¡£
Ò»¡¢Global.asax.csÖеĴúÂ룺
public class MvcApplication : System.Web.HttpApplication
{
&n ......
asp.net ajaxÖÐÎÄÂÒÂëµÄ½â¾ö£¿
2010-01-19 12:06
ÒÔǰûÔõô×ÐϸµÄÑо¿¹ýajax,Ö»ÊÇÓõ½Á˾ÍÖ±½ÓÄùýÀ´ÓÃ,·¢ÏÖÁËÎÊÌâÔÙÕÒ½â¾ö·½·¨.ÒÔÏÂÊÇÎÒÔÚÕÒ½â¾öÎÊÌâµÄ¹ý³ÌÖеÄÒ»µãССµÄ×ܽá.
Ò».̸AjaxµÄGetºÍPostµÄÇø±ð
Get·½Ê½:
ÓÃget·½Ê½¿É´«Ëͼòµ¥Êý¾Ý£¬µ«´óСһ°ãÏÞÖÆÔÚ1KBÏ£¬Êý¾Ý×·¼Óµ½urlÖз¢Ë ......
Ä£°å»¯µÄÊý¾Ý°ó¶¨¿Ø¼þΪÎÒÃÇÔÚÒ³ÃæÉÏÏÔʾÊý¾ÝÌṩÁ˸ù±¾µÄÁé»îÐÔ¡£Äã¿ÉÄÜ»¹¼ÇµÃASP.NET v1.xÖеļ¸¸öÄ£°å»¯¿Ø¼þ£¨ÀýÈçDataListºÍRepeater¿Ø¼þ£©¡£ASP.NET 2.0ÈÔȻ֧³ÖÕâЩ¿Ø¼þ£¬µ«ÔÚÄ£°åÖаó¶¨Êý¾ÝµÄÓï·¨ÒѾ±»¼ò»¯ºÍ¸ÄÉÆÁË¡£±¾ÎĽ«ÌÖÂÛÔÚÊý¾Ý°ó¶¨¿Ø¼þÄ£°åÖаó¶¨Êý¾ÝµÄ¶àÖÖ·½·¨¡£
Êý¾Ý°ó¶¨±í´ïʽ
ASP.NET 2.0¸ÄÉÆÁËÄ£°åÖÐ ......