ÔÚASP.NETÖÐʹÓÃGlobal.asaxÎļþ
Global.asaxÎļþ£¬ÓÐʱºò½Ð×öÓ¦ÓóÌÐòÎļþ£¬ÌṩÁËÒ»ÖÖÔÚÒ»¸öÖÐÐÄλÖÃÏìÓ¦Ó¦ÓóÌÐò¼¶»òÄ£¿é¼¶Ê¼þµÄ·½·¨¡£Äã¿ÉÒÔʹÓÃÕâ¸öÎļþʵÏÖÓ¦ÓóÌÐò°²È«ÐÔÒÔ¼°ÆäËüһЩÈÎÎñ¡£ÏÂÃæÈÃÎÒÃÇÏêϸ¿´Ò»ÏÂÈçºÎÔÚÓ¦Óù¤×÷ÖÐʹÓÃÕâ¸öÎļþ¡£
¸ÅÊö
Global.asaxλÓÚÓ¦ÓóÌÐò¸ùĿ¼Ï¡£ËäÈ»VisualStudio.NET»á×Ô¶¯²åÈëÕâ¸öÎļþµ½ËùÓеÄASP.NETÏîÄ¿ÖУ¬µ«ÊÇËüʵ¼ÊÉÏÊÇÒ»¸ö¿ÉÑ¡Îļþ¡£É¾³ýËü²»»á³öÎÊÌâ——µ±È»ÊÇÔÚÄãûÓÐʹÓÃËüµÄÇé¿öÏ¡£.asaxÎļþÀ©Õ¹ÃûÖ¸³öËüÊÇÒ»¸öÓ¦ÓóÌÐòÎļþ£¬¶ø²»ÊÇÒ»¸öʹÓÃaspxµÄASP.NETÎļþ¡£
Global.asaxÎļþ±»ÎªÈκΣ¨Í¨¹ýURLµÄ£©Ö±½ÓHTTPÇëÇ󶼱»×Ô¶¯¾Ü¾ø£¬ËùÒÔÓû§²»ÄÜÏÂÔØ»ò²é¿´ÆäÄÚÈÝ¡£ASP.NETÒ³Ãæ¿ò¼ÜÄܹ»×Ô¶¯Ê¶±ð³ö¶ÔGlobal.asaxÎļþËù×öµÄÈκθü¸Ä¡£ÔÚGlobal.asax±»¸ü¸ÄºóASP.NETÒ³Ãæ¿ò¼Ü»áÖØÐÂÆô¶¯Ó¦ÓóÌÐò£¬°üÀ¨¹Ø±ÕËùÓеÄä¯ÀÀÆ÷»á»°£¬È¥³ýËùÓÐ״̬£¬²¢ÖØÐÂÆô¶¯Ó¦ÓóÌÐòÓò¡£
±à³Ì
Global.asaxÎļþ¼Ì³Ð×ÔHttpApplicationÀ࣬Ëüά»¤Ò»¸öHttpApplication¶ÔÏó³Ø£¬²¢ÔÚÐèҪʱ½«¶ÔÏó³ØÖеĶÔÏó·ÖÅä¸øÓ¦ÓóÌÐò¡£Global.asaxÎļþ°üº¬ÒÔÏÂʼþ£º
Application_Init£ºÔÚÓ¦ÓóÌÐò±»ÊµÀý»¯»òµÚÒ»´Î±»µ÷ÓÃʱ£¬¸Ãʼþ±»´¥·¢¡£¶ÔÓÚËùÓеÄHttpApplication¶ÔÏóʵÀý£¬Ëü¶¼»á±»µ÷Óá£
Application_Disposed£ºÔÚÓ¦ÓóÌÐò±»Ïú»Ù֮ǰ´¥·¢¡£ÕâÊÇÇå³ýÒÔÇ°ËùÓÃ×ÊÔ´µÄÀíÏëλÖá£
Application_Error£ºµ±Ó¦ÓóÌÐòÖÐÓöµ½Ò»¸öδ´¦ÀíµÄÒ쳣ʱ£¬¸Ãʼþ±»´¥·¢¡£
Application_Start£ºÔÚHttpApplicationÀàµÄµÚÒ»¸öʵÀý±»´´½¨Ê±£¬¸Ãʼþ±»´¥·¢¡£ËüÔÊÐíÄã´´½¨¿ÉÒÔÓÉËùÓÐHttpApplicationʵÀý·ÃÎʵĶÔÏó¡£
Application_End£ºÔÚHttpApplicationÀàµÄ×îºóÒ»¸öʵÀý±»Ïú»Ùʱ£¬¸Ãʼþ±»´¥·¢¡£ÔÚÒ»¸öÓ¦ÓóÌÐòµÄÉúÃüÖÜÆÚÄÚËüÖ»±»´¥·¢Ò»´Î¡£
Application_BeginRequest£ºÔÚ½ÓÊÕµ½Ò»¸öÓ¦ÓóÌÐòÇëÇóʱ´¥·¢¡£¶ÔÓÚÒ»¸öÇëÇóÀ´Ëµ£¬ËüÊǵÚÒ»¸ö±»´¥·¢µÄʼþ£¬ÇëÇóÒ»°ãÊÇÓû§ÊäÈëµÄÒ»¸öÒ³ÃæÇëÇó£¨URL£©¡£
Application_EndRequest£ºÕë¶ÔÓ¦ÓóÌÐòÇëÇóµÄ×îºóÒ»¸öʼþ¡£
Application_PreRequestHandlerExecute£ºÔÚASP.NETÒ³Ãæ¿ò¼Ü¿ªÊ¼Ö´ÐÐÖîÈçÒ³Ãæ»òWeb·þÎñÖ®ÀàµÄʼþ´¦Àí³ÌÐò֮ǰ£¬¸Ãʼþ±»´¥·¢¡£
Application_PostRequestHandlerExecute£ºÔÚASP.NETÒ³Ãæ¿ò¼Ü½áÊøÖ´ÐÐÒ»¸öʼþ´¦Àí³ÌÐòʱ£¬¸Ãʼþ±»´¥·¢¡£
Applcation_PreSendRequestHeaders£ºÔÚASP.NETÒ³Ãæ¿ò¼Ü·¢ËÍHTTPÍ·¸øÇëÇó¿Í»§£¨ä¯ÀÀÆ÷£©Ê±£¬¸Ãʼþ±»´¥·¢¡£
Application_PreSendContent£ºÔÚASP.NETÒ³Ãæ¿ò
Ïà¹ØÎĵµ£º
ÔÚasp.netÖе¼³öexcel ÖбȽÏͨÐеÄ×ö·¨ÊÇ: Response.ContentType = "application/vnd.ms-excel";
È»ºóÖ±½ÓÏòÀïÃæÈÓ html µÄtable
µ«ÊÇÓÐÖÐÎĵÄʱºò ÀϳöÏÖÂÒÂ룬Óкܶà½â¾ö·½°¸£¬µ«¶¼²»ÄÜͨÅ̽â¾ö, ¾ÍÊÇÔÚ Êä³öhtmlÁ½Í·Êä³ö
Response.Write("<html><head><meta http-equiv=Content-Type conte ......
URL ÖØдÊǽØÈ¡´«Èë Web ÇëÇó²¢×Ô¶¯½«ÇëÇóÖض¨Ïòµ½ÆäËû URL µÄ¹ý³Ì¡£
±ÈÈçä¯ÀÀÆ÷·¢À´ÇëÇóhostname/101.aspx £¬·þÎñÆ÷×Ô¶¯½«Õâ¸öÇëÇóÖж¨ÏòΪhttp://hostname/list.aspx?id=101¡£
urlÖØдµÄÓŵãÔÚÓÚ£º
Ëõ¶Ìurl£¬Òþ²Øʵ¼Ê·¾¶Ìá¸ß°²È«ÐÔ
Ò×ÓÚÓû§¼ÇÒäºÍ¼ ......
One of my bank customers planned to roll out a new ASP.NET web application serving as their critical internet banking portal. They faced some weird performance issue in their UAT environment. They noticed the CPU utilization was really high (above 90%) without any fluctuation. After checking ......
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
using System.Text;
namespace Maticsoft.DBUtility
{
/// <summary>
  ......