Response.Write("<SCRIPT LANGUAGE='Javascript'><!--" + Environment.NewLine);
Response.Write("var timeOut=" + Convert.ToString(Session.Timeout*60) + "; var count=1; window.setTimeout('startClock()', 1000);" + Environment.NewLine);
Response.Write("function startClock() { " + Environment.NewLine);
Response.Write("timeOut=timeOut-count; window.setTimeout('startClock()', 1000);" + Environment.NewLine);
Response.Write("if (timeOut==0) { " + Environment.NewLine);
Response.Write("alert('Your session is timeout, please login again to continue...'); window.open('login.aspx', '_self'); }" + Environment.NewLine);
Response.Write(" } " + Environment.NewLine);
Response.Write("//--></SCRIPT>" + Environment.NewLine);

解决方案 »

  1.   

    public IList GetEntities(String query)
            {
                IList lst;
                ISession s=SessionFactory.OpenSession();
                ITransaction t=s.BeginTransaction();            lst=s.Find(query);
                t.Commit();
                s.Close();
                return lst;
            }        public Object GetEntity(Type theType,Object id)
            {
                Object obj;
                ISession s=SessionFactory.OpenSession();
                ITransaction t=s.BeginTransaction();
                obj=s.Load(theType,id);
                t.Commit();
                s.Close();
                return obj;