国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

vs2005下Global.asax缺少cs文件的解決方法

2024-07-10 12:38:04
字體:
來源:轉載
供稿:網友

VS2005中發現Global.ascx沒有cs文件,所有程序都需要寫在一個文件,下面給出一個具體的解決方法:

通過在App_Code文件夾下創建一個類Global.cs,同時該類使用partial修飾且繼承System.Web.HttpApplication。

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;

/// <summary>
/// Global 的摘要說明
/// </summary>
public partial class Global : System.Web.HttpApplication
{
#region 默認構造函數
public Global()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
#endregion

 

void Application_Start(object sender, EventArgs e)
{
// 在應用程序啟動時運行的代碼
}

void Application_End(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
}

}

然后Global.asax繼承該類即可

<%@ Application Language="C#" Inherits="Global" %>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 铜川市| 宝鸡市| 泸水县| 安康市| 洪雅县| 芦山县| 阿瓦提县| 江达县| 涿州市| 永泰县| 绥化市| 太康县| 泾阳县| 石屏县| 永胜县| 革吉县| 建昌县| 囊谦县| 双流县| 凤山市| 乌鲁木齐县| 建昌县| 大同县| 若尔盖县| 襄垣县| 温宿县| 阿拉尔市| 全州县| 修武县| 娄烦县| 松滋市| 北安市| 呼伦贝尔市| 襄垣县| 肇庆市| 安溪县| 诏安县| 中阳县| 弥渡县| 龙井市| 双牌县|