using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace WebForm.Common { public class BasePage : System.Web.UI.Page { protected override void OnInit(EventArgs e) { base.OnInit(e); this.CheckUrl(); this.CheckLogin(); this.CheckApp(); this.InitInclude(); } /// /// 初始化页面 /// protected virtual void InitInclude() { if (Page.Header != null) { Page.Header.Controls.AddAt(Page.Header.Controls.Count - 1, new System.Web.UI.WebControls.Literal() { Text = Tools.IncludeFiles }); } } /// /// 检查是否登录 /// /// protected virtual bool CheckLogin(bool isRedirect = true) { return Tools.CheckLogin(isRedirect); } /// /// 检查访问地址 /// /// /// protected virtual bool CheckUrl(bool isEnd = true) { return Tools.CheckReferrer(isEnd); } /// /// 检查应用权限 /// /// /// protected virtual bool CheckApp() { string msg; return Tools.CheckApp(out msg); } /// /// 当前登录用户 /// public static RoadFlow.Data.Model.Users CurrentUser { get { return RoadFlow.Platform.Users.CurrentUser; } } /// /// 当前登录用户ID /// public static Guid CurrentUserID { get { return RoadFlow.Platform.Users.CurrentUserID; } } /// /// 当前用户姓名 /// public static string CurrentUserName { get { return RoadFlow.Platform.Users.CurrentUserName; } } /// /// 应用程序路径 /// public static string SitePath { get { return Tools.BaseUrl; } } } }