using System; using System.Collections.Generic; using System.Text; using System.Web.Security; using System.Web; namespace Mtxfw.Utility { public class AdminPage :System.Web.UI.Page { private string _IdentityName = string.Empty; /// /// 获取当前管理员名称 /// protected string IdentityName { get { HttpCookie Cookie = Request.Cookies[System.Web.Security.FormsAuthentication.FormsCookieName]; if (Cookie != null) { FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(Cookie.Value); string[] roles = authTicket.UserData.Split(new char[] { ',' }); Context.User = new System.Security.Principal.GenericPrincipal(Context.User.Identity, roles); return Context.User.Identity.Name; } else { return _IdentityName; } } } /// /// 获取站点名称 /// protected string WebName { get { Config config = new Config(""); return config.webName; } } /// /// 获取图片上传的格式 /// protected string UploadType { get { Config c = new Config(""); return c.webUpType; } } /// /// 获取图片上传保存的路径 /// protected string UploadPath { get { Config c = new Config(""); return c.webUpPath; } } /// /// 获取文件上传允许的大小 /// protected int UpImgSize { get { Config c = new Config(""); try { return int.Parse(c.webUpSize); } catch { return 0; } } } /// /// 获取 HTTP 查询字符串变量集合 /// protected string Get(string name) { return System.Web.HttpContext.Current.Request.QueryString[name]; } /// /// 获取角色对应的省份 /// protected string Getprovince(string strJS) { string strprovince = ""; if (strJS == "北京管理员") { strprovince = "110000"; } if (strJS == "天津管理员") { strprovince = "120000"; } if (strJS == "河北管理员") { strprovince = "130000"; } if (strJS == "山西管理员") { strprovince = "140000"; } if (strJS == "辽宁管理员") { strprovince = "210000"; } if (strJS == "吉林管理员") { strprovince = "220000"; } if (strJS == "黑龙江管理员") { strprovince = "230000"; } if (strJS == "上海市") { strprovince = "310000"; } if (strJS == "江苏管理员") { strprovince = "320000"; } if (strJS == "浙江管理员") { strprovince = "330000"; } if (strJS == "安徽管理员") { strprovince = "340000"; } if (strJS == "福建管理员") { strprovince = "350000"; } if (strJS == "江西管理员") { strprovince = "360000"; } if (strJS == "山东管理员") { strprovince = "370000"; } if (strJS == "河南管理员") { strprovince = "410000"; } if (strJS == "湖北管理员") { strprovince = "420000"; } if (strJS == "湖南管理员") { strprovince = "430000"; } if (strJS == "广东管理员") { strprovince = "440000"; } if (strJS == "海南管理员") { strprovince = "460000"; } if (strJS == "重庆管理员") { strprovince = "500000"; } if (strJS == "四川管理员") { strprovince = "510000"; } if (strJS == "贵州管理员") { strprovince = "520000"; } if (strJS == "云南管理员") { strprovince = "530000"; } if (strJS == "陕西管理员") { strprovince = "610000"; } if (strJS == "甘肃管理员") { strprovince = "620000"; } if (strJS == "青海管理员") { strprovince = "630000"; } if (strJS == "台湾管理员") { strprovince = "710000"; } if (strJS == "广西管理员") { strprovince = "450000"; } return strprovince; } } }