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

📄 head.ascx.cs

📁 这是我制作的一个小论坛源码··能够简单实现发表帖子··管理帖子·后台管理等功能
💻 CS
字号:
namespace bbs
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// <summary>
	///		head 的摘要说明。
	/// </summary>
	public class head : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.Label Label_name;
		protected System.Web.UI.WebControls.LinkButton LinkButton_out;
		protected System.Web.UI.WebControls.Literal Literal_panel;
		protected System.Web.UI.WebControls.Panel Panel1;
		protected System.Web.UI.WebControls.LinkButton LinkButton_ToM;

		private void Page_Load(object sender, System.EventArgs e)
		{

			if(!Page.IsPostBack)
			{	
				if(Session["username"]!=null || Session["username"].ToString()!="")
				{
					this.Label_name.Text=Session["username"].ToString() + this.Literal_panel.Text;
					if(Session["iPowerLevels"].ToString()!=null ||Session["iPowerLevels"].ToString()!="")
					{
						string iPowerLevels=Session["iPowerLevels"].ToString();

						int iLevels=Convert.ToInt32(iPowerLevels);
						if(iLevels==2)
						{
							this.Panel1.Visible=true;
						}
						else
						{
							this.Panel1.Visible=false;
						}
					}
					else
					{
						Response.Redirect("login.aspx");
					}
				}
				else
				{
					Response.Redirect("Error.aspx");
				}
			}// 在此处放置用户代码以初始化页面
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		设计器支持所需的方法 - 不要使用代码编辑器
		///		修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.LinkButton_ToM.Click += new System.EventHandler(this.LinkButton_ToM_Click);
			this.LinkButton_out.Click += new System.EventHandler(this.LinkButton_out_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void LinkButton_out_Click(object sender, System.EventArgs e)
		{
			Session.Abandon();
			string parentWindowUrl = "login.aspx";
			string js = @"<Script language='JavaScript'>
                    this.parent.location.replace('" + parentWindowUrl + "');</Script>";
			HttpContext.Current.Response.Write(js);
			return;
		}

		private void LinkButton_ToM_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("Manage.aspx");
		}
	}
}

⌨️ 快捷键说明

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