protected void Page_Load(object sender, EventArgs e) { USERIP = System.Web.HttpContext.Current.Request.UserHostAddress; if (!IsPostBack) { User_id.Text = Session["UserID"] == null ? "" : Session["UserID"].ToString();//提取UserID //客户端弹出验证消息框 //WinVal WinValInstance = new WinVal(); //WinValInstance.ValStyle = "toppoptip"; //WinValInstance.SetValidator(); AbsoluteUrl.Text = Request.Url.AbsoluteUri; string con = PageOperate.GetNullToString(AbsoluteUrl.Text.Trim()); if (con == "") { PageOperate.AlertAndRedirect("请填写内容", "Build.aspx"); return; } if (ImgCode.ImageUrl == "") { ImgCode.ImageUrl = "/Handler.ashx?data=" + Server.HtmlEncode(con) + "&len=4"; } Random r = new Random(); Image1.ImageUrl = "/images/random/V" + (r.Next(12) + 1) + ".jpg"; if (!String.IsNullOrEmpty(Request.QueryString["ID"])) { ArticleID.Text = Request.QueryString["ID"].Trim(); MyInit(); } } DBView(); System.Threading.Thread.Sleep(500); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //客户端弹出验证消息框 //WinVal WinValInstance = new WinVal(); //WinValInstance.ValStyle = "toppoptip"; //WinValInstance.SetValidator(); AbsoluteUrl.Text = Request.Url.AbsoluteUri; string con = PageOperate.GetNullToString(AbsoluteUrl.Text.Trim()); if (con == "") { PageOperate.AlertAndRedirect("请填写内容", "Build.aspx"); return; } if (ImgCode.ImageUrl == "") { ImgCode.ImageUrl = "/Handler.ashx?data=" + Server.HtmlEncode(con) + "&len=4"; } if (Session["RoleID"] == null || Session["UserID"] == null) { Literal1.Text = "<a href='/Login2.aspx?u=0' target='_blank'>用户登录</a>"; Literal2.Text = "<a href='/Register2.aspx' target='_blank'>用户注册</a>"; } else { string username = "******" + Convert.ToString(Session["UserName"]); Literal1.Text = "<a href='/User_Center.aspx?' target='_blank'>" + username + "</a>"; Literal2.Text = "<a href='/login2.aspx' target='_blank'>退出</a>"; } MyDataBind2(); } }