<a href="javascript:window.close()">关闭窗口</a>

解决方案 »

  1.   

    在每一个Web项目中有这样一组文件Global.asax和Global.asax.cs
    这里包含了对整个项目启动的一些控制。仅供参考:
    public class Global : System.Web.HttpApplication
    {
    public Global()
    {
    InitializeComponent();
    }

    protected void Application_Start(Object sender, EventArgs e)
    { }
     
    protected void Session_Start(Object sender, EventArgs e)
    { } protected void Application_BeginRequest(Object sender, EventArgs e)
    {
    } protected void Application_EndRequest(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)
    { }事件包括:
    AcquireRequestState 当 ASP.NET 获取与当前请求关联的当前状态(如会话状态)时发生。 
    AuthenticateRequest 当安全模块已建立用户标识时发生。 
    AuthorizeRequest 当安全模块已验证用户授权时发生。 
    BeginRequest 在 ASP.NET 响应请求时作为 HTTP 执行管线链中的第一个事件发生。 
    Disposed 在 ASP.NET 在响应请求时完成执行链后发生。 
    EndRequest 在 ASP.NET 响应请求时作为 HTTP 执行管线链中的最后一个事件发生。 
    Error 当引发未处理的异常时发生。 
    PostRequestHandlerExecute 当 ASP.NET 处理程序(页、XML Web services)执行完成时发生。 
    PreRequestHandlerExecute 恰好在 ASP.NET 开始执行处理程序(如页或 XML Web services)之前发生。 
    PreSendRequestContent 恰好在 ASP.NET 向客户端发送内容之前发生。 
    PreSendRequestHeaders 恰好在 ASP.NET 向客户端发送 HTTP 标头之前发生。 
    ReleaseRequestState 在 ASP.NET 执行完所有请求处理程序后发生。该事件将使状态模块保存当前状态数据。 
    ResolveRequestCache 当 ASP.NET 完成授权事件以使缓存模块从缓存中为请求提供服务时发生,从而跳过处理程序(如页或 XML Web services)的执行。 
    UpdateRequestCache 当 ASP.NET 执行完处理程序以使缓存模块存储将用于从缓存为后面的请求提供服务的响应时发生。 
      

  2.   

    可否把线程句柄保存在sesion中,在session_end的是否去销毁它
    不过!如果Session丢失了怎么办?