public void TestMethod1() { UserInfo user = new UserInfo(); user.find(); Assert.IsNotNull(user.User); Console.WriteLine("user is " + user.User); user.save(); }
protected void Button1_Click(object sender, EventArgs e) { if (!__bxmlCheck0.Checked) { __bxmlLabel.Visible = true; return; } UserInfo userInfo = new UserInfo(); userInfo.find(); userInfo.setReadNow(); userInfo.save(); Response.Redirect(UserInfo.ProtectedPageUrl()); }
private void AuthenticateRequest(Object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; HttpContext context = app.Context; HttpRequest Request = context.Request; String username = ""; try { username = context.User.Identity.Name; } catch (Exception) { } log.Debug(username + " AuthenticateRequest Request.Url.LocalPath = " + Request.Url.LocalPath); log.Debug(UserInfo.getUserId() + " AuthenticateRequest Request.Url.ProtectedPath = " + UserInfo.ProtectedPageUrl()); if (!Request.Url.LocalPath.Equals(UserInfo.ProtectedPageUrl())) { log.Debug("return"); return; } log.Debug("continue"); HttpResponse Response = app.Context.Response; UserInfo userInfo = new UserInfo(); userInfo.find(username); Boolean readAgreement = userInfo.hasReadTheAgreement(); log.Debug(UserInfo.getUserId() + " readAgreement = " + readAgreement); if (IsPost(context) && !IsAccessingLoginPage(context, UserInfo.MessageUrl())) { if (!readAgreement) { // Create a FormState instance with the current form post contents and store a 'pointer' // to this instance in a cookie, so we can find it again after relogin. FormState state = FormState.Create(context); if (state != null) { HttpCookie cookie = new HttpCookie(CookieName, state.StateId); cookie.HttpOnly = true; context.Response.Cookies.Add(cookie); } Response.Redirect(UserInfo.MessageUrl()); } } }