近日管理一.net開發的網站,需要利用global.asax文件對整個網站的輸入性訪問進行驗證,但網站根目錄中並沒有global.asax這個文件,費了好大勁都沒有找到,考慮到有部分網頁也可能會有此需求,特將此文件的原始代理貼上。
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// 在應用程序啓動時運行的代碼
{
// 在應用程序啓動時運行的代碼
}
void Application_End(object sender, EventArgs e)
{
// 在應用程序關閉時運行的代碼
void Application_End(object sender, EventArgs e)
{
// 在應用程序關閉時運行的代碼
}
void Application_Error(object sender, EventArgs e)
{
// 在出現未處理的錯誤時運行的代碼
void Application_Error(object sender, EventArgs e)
{
// 在出現未處理的錯誤時運行的代碼
}
void Session_Start(object sender, EventArgs e)
{
// 在新會話啓動時運行的代碼
{
// 在新會話啓動時運行的代碼
}
void Session_End(object sender, EventArgs e)
{
// 在會話結束時運行的代碼。
// 注意: 只有在 Web.config 文件中的 sessionstate 模式設置爲
// InProc 時,纔會引發 Session_End 事件。如果會話模式設置爲 StateServer
// 或 SQLServer,則不會引發該事件。
{
// 在會話結束時運行的代碼。
// 注意: 只有在 Web.config 文件中的 sessionstate 模式設置爲
// InProc 時,纔會引發 Session_End 事件。如果會話模式設置爲 StateServer
// 或 SQLServer,則不會引發該事件。
}
protected void Application_BeginRequest(Object sender, EventArgs e)
{
protected void Application_BeginRequest(Object sender, EventArgs e)
{
</script>