ASP.NETµÄglobal.asaxÎļþ
ASP.NETÔÊÐíÎÒÃÇÔÚglobal.asaxÎļþÖбàдÄܹ»½ÓÊÜÈ«¾ÖʼþµÄʼþ´¦ÀíÆ÷¡£Óû§²»»áÖ±½ÓÇëÇóÕâ¸öglobal.asaxÎļþ£¬¶øÊÇÔÚÏìÓ¦Ò»¸öÈ·¶¨µÄÓ¦ÓóÌÐòʼþÖÐ×Ô¶¯µÄÖ´ÐÐglobal.asaxÎļþ¡£global.asaxÎļþÌṩÁ˸ú´«Í³µÄASPÓ¦ÓóÌÐòÖеÄglobal.asaÎļþÀàËƵķþÎñ¡£
ÔÚglobal.asaxÎļþÖбàд´úÂë¸ú±àдWebFormµÄ´úÂëÀàËÆ£¬²»Í¬µÄÊÇglobal.asaxÎļþÖв»°üº¬ÈκÎHTML»òASP.NET±êÇ©£¬Ïà·´Ëü°üº¬ÁËһЩÌض¨µÄÔ¤¶¨ÒåµÄ·½·¨¡£ÀýÈ磬ÏÂÃæµÄÀý×ÓÖÐÔÚglobal.asaxÎļþÖж¨ÒåÁËÒ»¸ö½ØÈ¡HttpApplication.EndRequestʼþµÄʼþ´¦ÀíÆ÷¡£Õâ¸öʼþÔÚÍøÒ³±»·¢Ë͸øÓû§Ö®Ç°·¢Éú¡£
<%@ Application Language="C#" %>
<script language="C#" runat="server">
protected void Application_OnEndRequest()
{
Response.Write("<hr />This page was served at " +
DateTime.Now.ToString());
}
</script>
¾¡¹ÜÔÚglobal.asaxÎļþÖÐûÓÐÖ¸¶¨£¬µ«ÊÇglobal.asaxÎļþ¶¨ÒåµÄ·½·¨¶¼»á±»·Åµ½Ò»¸öµ¥¶ÀµÄÀࣨapplicationÀࣩÖУ¬applicationÀà¼Ì³ÐÁËHttpApplicationÀ࣬ÔÚ×Ô¶¨Òå´úÂëÖпÉÒÔ·ÃÎÊHttpApplicationÀàÖÐËùÓеÄPublicºÍProtected³ÉÔ±¡£ÔÚÉÏÃæµÄÀý×ÓÖÐʹÓÃÁËResponse¶ÔÏó£¨HttpApplicationÀàÌṩÄÚÖÃÊôÐÔ£©¡£
Ïà¹ØÎĵµ£º
1.ʲôÊǸöÐÔ»¯·þÎñ ¸öÐÔ»¯·þÎñÊÇÒ»ÖÖ¼¼Êõ¿ò¼Ü£¬ÎªÓû§ÌṩÁË×Ô¶¨ÒåÕ¾µãÍâ¹Û¡¢ÄÚÈÝ¡¢²¼¾Ö¡¢½ÇÉ«¹ÜÀíµÈ¹¦ÄÜ£¬ÈçͬQQ¿Õ¼äµÈ¡£ 2.¸öÐÔ»¯·þÎñÐèÒª³ÌÐòԱѧϰÄÄЩ·½Ã棬²ÅÄÜʵÏÖÕâЩ¹¦ÄÜ ¸öÐÔ»¯·þÎñÊÇÒ»¸ö¿ò¼Ü£¬Õâ¸ö¿ò¼Ü°üº¬3¸öºËÐŦÄÜ£º¸öÐÔ»¯Óû§ÅäÖá¢web²¿¼þ¡¢³ÉÔ±×ʸñÓë½ÇÉ«¹ÜÀí¡£ÎÒÃǾÍÊÇÒª×ÅÖØѧϰÕâ3¸ö¹¦ÄÜ¡ ......
ASP.NETÖеÄÉí·ÝÑéÖ¤(authentication)ÓÐÄÄЩ
=========================================
FormsÉí·ÝÑéÖ¤£º
ͨ¹ýÆä¿É½«Ã»ÓÐͨ¹ýÉí·ÝÑéÖ¤µÄÇëÇóÖض¨Ïòµ½Ê¹Óà HTTP ¿Í»§¶ËÖض¨ÏòµÄ HTML ´°ÌåµÄϵͳ¡£Óû§Ìṩƾ
¾Ý²¢Ìá½»¸Ã´°Ìå¡£Èç¹ûÓ¦ÓóÌÐòÑéÖ¤¸ÃÇëÇó£¬ÏµÍ³¾Í»á·¢³ö°üº¬Æ¾¾Ý»òÃÜÔ¿µÄ Cookie ÒÔÖØлñÈ¡¸Ã±êʶ
¡£ºóÐøµÄ ......
ÔÚEmailϵͳÖо³£»áÉÏ´«¶à¸öÎļþµ½·þÎñÆ÷£¬Óû§´ó¶àÏ°¹ßÒ»´ÎÉÏ´«ËùÓеÄÎļþ£¬¶ø²»ÊÇÖð¸öÉÏ´«£¬ÎÒÃÇ¿ÉÒÔʹÓÃjavascript¶¯Ì¬µØÌí¼ÓfileÔªËص½±íµ¥£¬È»ºóÔÚ·þÎñÆ÷¶Ë´¦ÀíÕâЩfile
Ч¹ûͼÈçÏÂ:
Ò³Ãæ´úÂëMutlileFileUpload.aspxÈçÏÂ:
view plaincopy to clipboardprint?
<%@ Page Language="C#" AutoEventWireup="true" C ......
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" & ......
(Ò»).Ñ¡Ôñ»á»°×´Ì¬´æ´¢·½Ê½
ÔÚWebconfigÎļþÅäÖÃ:
<sessionState mode="???" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=y ......