⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mstadmin.master.cs

📁 ASP.NET 2.0动态网站设计实例源代码,本书介绍了ASP.NET2.0的基础知识
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;

public partial class Admin_mstAdmin : System.Web.UI.MasterPage
{
 protected void Page_Load(object sender, EventArgs e)
 {
  string strScriptBlock;
  if (Session["User"] == null)
  {
   strScriptBlock = @"alert(""您没有登陆!"");window.navigate(""Login.aspx"");";
   Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "NotLoging" + this.UniqueID, strScriptBlock, true);
  }
  else if (((eNewsUser)Session["User"]).NewsUserPrivilege < 1)
  {
   strScriptBlock = @"alert(""您的权限不足!"");window.navigate(""~/default.aspx"");";
   Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "NotLoging" + this.UniqueID, strScriptBlock, true);
  }
  else if (((eNewsUser)Session["User"]).NewsUserPrivilege < 2)
  {
      strScriptBlock = @"alert(""您的权限不足!"");window.navigate(""default.aspx"");";
      Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "NotLoging" + this.UniqueID, strScriptBlock, true);
  }
  else
  {
   if (!IsPostBack)
   {
    DataTable dt = (DataTable)Application["Items"];
    TreeNode tn;
    for (int intCounter = 0; intCounter < dt.Rows.Count; intCounter++)
    {
     tn = new TreeNode();
     tn.NavigateUrl = "showItem.aspx?itemid=" + Convert.ToString(dt.Rows[intCounter]["NewsItemID"]);
     tn.Text = dt.Rows[intCounter]["NewsItemName"].ToString();
     tvNavigate.Nodes[0].ChildNodes.Add(tn);
    }
   }
  }
 }
 protected void lbLogOff_Click(object sender, EventArgs e)
 {
  Session.Clear();
  string strScriptBlock = @"alert(""谢谢您的登录!"");window.navigate(""login.aspx"");";
  Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "LogOff" + this.UniqueID, strScriptBlock, true);
 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -