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()); }
/* void Application_PostMapRequestHandler(object source, EventArgs e) { HttpApplication app = (HttpApplication)source; if (app.Context.Handler is IReadOnlySessionState || app.Context.Handler is IRequiresSessionState) { // no need to replace the current handler return; } // swap the current handler app.Context.Handler = new MyHttpHandler(app.Context.Handler); } void Application_PostAcquireRequestState(object source, EventArgs e) { HttpApplication app = (HttpApplication)source; MyHttpHandler resourceHttpHandler = HttpContext.Current.Handler as MyHttpHandler; if (resourceHttpHandler != null) { // set the original handler back HttpContext.Current.Handler = resourceHttpHandler.OriginalHandler; } // -> at this point session state should be available appSession = app.Session; }*/ /// <summary>Occurs when a security module has established the identity of the user.</summary> private void AuthenticateRequest(Object sender, EventArgs e) { HttpApplication app = (HttpApplication) sender; HttpContext context = app.Context; HttpRequest Request = context.Request; if (!Request.Url.LocalPath.Equals(UserInfo.ProtectedPageUrl())) return; HttpResponse Response = app.Context.Response; UserInfo userInfo = new UserInfo(); userInfo.find(); userInfo.Url = Request.Url.AbsolutePath; userInfo.save(); Boolean readAgreement = userInfo.hasReadTheAgreement(); if (!readAgreement) { 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()); } }