文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>WebSite建立能访问的Global

WebSite建立能访问的Global

时间:2010-08-31  来源:RedQ-Alright

由于WebSite建立的Global文件默认是内建式的,不在appcode里,所以无法访问,这时就需要我们手动修改.

<%@ Application Codebehind="App_Code\Global.cs" Inherits="Global" Language="C#" %>

然后在app_code中加入 Global类

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Timers;
public class Global : System.Web.HttpApplication
{
    public static Timer aTimer = new Timer();

    protected void Application_Start(object sender, EventArgs e)
    {
        Global.aTimer.Elapsed += new ElapsedEventHandler(aTimer_Elapsed);
    }

    void aTimer_Elapsed(object sender, ElapsedEventArgs e)
    {
        System.Data.DataTable ds = MySqlDB.GetChangesOnLdapServer();
        if (ds.Rows.Count > 0)
        {
            MySqlDB.AddNewUser(ds);
        }
    }
    protected void Session_Start(object sender, EventArgs e)
    {

    }

    protected void Application_BeginRequest(object sender, EventArgs e)
    {

    }

    protected void Application_AuthenticateRequest(object sender, EventArgs e)
    {

    }

    protected void Application_Error(object sender, EventArgs e)
    {

    }

    protected void Session_End(object sender, EventArgs e)
    {

    }

    protected void Application_End(object sender, EventArgs e)
    {

    }

}

 

相关阅读 更多 +
排行榜 更多 +
卡车模拟器

卡车模拟器

模拟经营 下载
果缘购

果缘购

购物比价 下载
死神vs火影绊炫光

死神vs火影绊炫光

动作格斗 下载