×Ô¶¨ÒåµÄWeb ServerÓëAsp.netµÄ´¦Àí»úÖÆ
¡¡ÎÒÃÇ·Ö3¸ö²¿·ÖÀ´ÌÖÂÛ.netµÄ´¦Àí¹ý³Ì¡£ÕâÀïÎÒÃÇÖ÷ÒªÌÖÂÛWebApplicationÒÔÉϵÄÁ½¸ö²¿·Ö¡£Öмä»á¶Ô±ÈIISÔÚAsp.netÖеĽÇÉ«¡£
¡¡¡¡Á˽âÕâЩ¹ý³ÌÖ®ºó£¬ÎÒÃǾͿÉÒÔ¶¨Òå×Ô¼ºµÄWebServer¡£WebServer²»ÊÇÖ»ÓÐIISµÄ£¬Ã»ÁËËü£¬asp³ÌÐòÕÕÑù¹ýÈÕ×Ó¡£
¡¡¡¡ÕâÀïʹÓõÄÀý×ÓÊÇWebMatrixµÄWebHostµÄʵÏÖ¡£Í¨¹ýÐÞ¸ÄÕâЩÀ࣬À´ÊµÏÖÎÒ×Ô¼ºµÄÒ»¸öС¹¦ÄÜ£ºHostΪÿ¸öWebApp·ÖÅäÒ»¸öServiceManagerµÄʵÀý¡£(ûÓаæȨÎÊÌâ°É?)
¡¡¡¡¿ªÊ¼°É
¡¡¡¡µÚÒ»²¿·Ö£ºWebHost
¡¡¡¡´Ó¶Ë¿ÚÕìÌýÇëÇ󣬽ÓÊÜÇëÇó£¬ÐγÉHttpWorkerRequest
¡¡¡¡1£º´´½¨socket¶Ë¿Ú½ÓÌý
¡¡¡¡listener¶øÒÑ¡£
¡¡¡¡2£º´´½¨WebHost
¡¡¡¡Í¨¹ý.netÌṩµÄApplicationHost.CreateApplicationHost(typeof(Host), virtualPath, physicalPath)¾²Ì¬º¯ÊýÀ´´´½¨Asp.net´¦ÀíµÄËÞÖ÷¿Õ¼ä¡£
¡¡¡¡Õâ¸öHost¼Ì³Ð×ÔMarshalByRefObject£¬¿ÉÒÔ¿ç³ÌÐòÓòµ÷Óá£ÕâÊǹؼü£¬ÒòΪÿ¸öWebApp»á±»·ÖÅäÒ»¸öAppDomain£¬½øÐÐÔËÐС£ËùÒÔHostÒª¿ÉÒÔ´´½¨ÕâЩAppDomain£¬²¢ÇÒ¿ÉÒÔµ÷Óá£
¡¡¡¡3£ºÊµÏÖ³éÏóÀàHttpWorkerRequest
¡¡¡¡.netÌṩÁËÒ»¸öSimpleWorkerRequestµÄʵÏÖ¡£¼òµ¥µÄ¿ÉÒÔÖ±½Óµ÷ÓÃËü¡£¸´ÔÓÒ»µãµÄ»°£¬ÐèÒª×Ô¼ºÖØд¸ü¶àµÄ·½·¨¡£
¡¡¡¡Õâ¸öÀà¾ÍÊÇ·â×°ÁËËùÓÐÏòÏ´«µÝµÄÊôÐÔºÍÊý¾Ý¡£
¡¡¡¡ÕâʱWebHostºÍ¾ßÌåµÄÿ¸öWebAppµÄΨһÁ¬½Óµã¡£
¡¡¡¡µÚ¶þ²¿·Ö£º´¦ÀíHttpWorkerRequest
¡¡¡¡¸ù¾ÝHttpWorkerRequest£¬ÊµÀý»¯³öHttpContextºÍIHttpHandler¡£ Õⲿ·ÖºÃÏñ¾Í½øÁË.netÄÚ²¿µÄ¼¸¸öÀàÁË¡£²»ÖªµÀÄܲ»ÄÜÔÚ¿ØÖÆ¡£
¡¡¡¡1£ºHttpRuntimeµÄµÚÒ»´Î´¦Àí
¡¡¡¡¸ù¾ÝHttpWorkerRequest ´´½¨context£¬¸ù¾Ýcontxt´´½¨IHttpHandlerʵÀý£¬hanlder¸ù¾ÝÕâ¸öcontext¿ªÊ¼ÔËÐС£È»ºó¾Íµ½ÁËÍøÒ³´¦ÀíÁË¡£
¡¡¡¡Í¨¹ýµ÷ÓÃSystem.Web.HttpRuntime.ProcessRequest(HttpWorkerRequest wr)¾²Ì¬º¯ÊýÀ´½øÈëÕâ¸ö´¦Àí¡£
¡¡¡¡System.Web.HttpRuntime½ÓÊܵ½HttpWorkerRequest¶ÔÏ󡣿´¿´Õâ¸öº¯Êý£º
¡¡public static void ProcessRequest(HttpWorkerRequest wr)
¡¡¡¡{
¡¡¡¡//ºöÂÔÆäËûϸ½Ú
¡¡¡¡HttpContext context1 = new HttpContext(wr, false);//¸ù¾ÝHttpWorkerRequest´´½¨context¡£¿ÉÒÔ¿´³öHttpWorkerRequestÊÇcontxtµÄ»ù´¡¡£
¡¡¡¡IHttpHandler handler1 = HttpApplicationFactory.GetApplicationInstance(context1);//¸ù¾Ýcontext´´½¨AppʵÀý
¡¡¡¡handler1.ProcessRequest(context1);//ÔËÐÐʵ
Ïà¹ØÎĵµ£º
ÎÊ£ºÎªÊ²Ã´SessionÔÚÓÐЩ»úÆ÷ÉÏż¶û»á¶ªÊ§£¿
´ð£º¿ÉÄܺͻúÆ÷µÄ»·¾³ÓйØϵ£¬±ÈÈ磺·À»ðǽ»òÕßɱ¶¾Èí¼þµÈ£¬³¢ÊԹرշÀ»ðǽ¡£
ÎÊ£ºÎªÊ²Ã´µ±µ÷ÓÃSession.Abandonʱ²¢Ã»Óм¤·¢Session_End·½·¨£¿
´ð£ºÊ×ÏÈSession_End·½·¨Ö»Ö§³ÖInProc£¨½ø³ÌÄڵģ©ÀàÐ͵ÄSession¡£Æä´ÎÒª¼¤·¢Session_End·½·¨£¬±ØÐë´æÔÚSession£¨¼´ÏµÍ³ÖÐÒÑ¾Ê¹Ó ......
Ò»¡¢×Ô¶¨Òå FCKeditor µÄ BasePathBasePath ¼´FCKeditorÔÚÍøÕ¾ÖеÄÏà¶Ô·¾¶£¬Ä¬ÈÏÖµÊÇ /fckeditor/£¬×îºÃÔÚWeb.config appSettingsÖжÔÆä½øÐÐÅäÖãº
<add key="FCKeditor:BasePath" value="/FCKeditor_2.6.3/"/>
ÕâÑù×öÓÐÖî¶àÓŵ㣺
1.¿ª·¢»·¾³ÓëÉú²ú»·¾³²»Í¬£¬¿ª·¢»·¾³Ò»°ãÊÇhttp://localhost/xxx.com/ÕâÖÖÇé¿öÏ ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
/// <summary>
/// Data ......
н¨Ò»¸öרÃÅÓÃÀ´´´½¨ÑéÖ¤ÂëͼƬµÄÒ³ÃæValidateCode.aspx
ËüµÄºǫ́csÎļþ´úÂëÈçÏ£º
PageLoad
private void Page_Load(object sender, System.EventArgs e)
{
string checkCode = CreateRandomCode(4);
Session["CheckCode"] = checkCode;
CreateImage(checkCode);
......
private bool IsPicture(string filePath)//filePathÊÇÎļþµÄÍêÕû·¾¶
{
try
......