📄 main.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace doughty_cn
{
/// <summary>
/// main 的摘要说明。
/// </summary>
public partial class main : System.Web.UI.Page
{
public string text;
protected void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (!this.IsPostBack)
{
text = CommonFuntion.getAffiche(0,0);
if (text!="")
text="<table width='100%' border=0><tr><td width=16><img src='image/announce.gif'>"
+"</td><td><MARQUEE onmouseover=this.stop() onmouseout=this.start() scrollAmount=3 width='95%'>"+text+"</MARQUEE></td></tr></table>";
if (System.Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["BorowsArea"])>2)
{
if (User.Identity.Name.ToString()=="")
{
this.Response.Redirect("logon.aspx");
}
}
int i=(int)Application.Get("logincount");
Lbl_UserCou.Text="在线人数:"+i.ToString();
//判断用户是否登录
if (Session["UserGrade"]==null)
Session["UserGrade"]=DBOperate.GetUserGrade(User.Identity.Name);
Lbl_UserGrade.Text="用户级别:"+ Session["UserGrade"].ToString();
if ((User.Identity.Name==null)||(User.Identity.Name==""))
{
Lbl_UserName.Text="当前用户:过客";
}
else
{
Lbl_UserName.Text="当前用户:"+User.Identity.Name.ToString();
}
HaveShortMsg();
Lbl_IP.Text=this.Request.UserHostAddress;
}
}
//计算是否有短消息
public void HaveShortMsg()
{
int intCount;
intCount=DBOperate.ShortMsgCount(this.User.Identity.Name.ToString());
if (intCount==0)
this.Panel2.Visible=false;
else
this.Panel2.Visible=true;
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
}
#endregion
//Response.Write("<script language=javascript>window.top.location.href='logon.aspx';</script>");
protected void LinkButton1_Click(object sender, System.EventArgs e)
{
//退出登录
System.Web.Security.FormsAuthentication.SignOut();
Session["UserGrade"]=null;
this.Response.Redirect("main.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -