public string LinksForLoggedInOrNot() { string R = ""; JITAD.User usr = (JITAD.User)Session["CurrentUser"]; string addReturnUrl = ""; if (Request.RawUrl != "/" && Request.RawUrl != "/Konto/Rejestracja" && Request.RawUrl != "/Konto/Zaloguj" && Request.RawUrl != "/PermissionDenied") { addReturnUrl = "?ReturnUrl=" + Request.RawUrl; } if (usr == null) { R += "<a href=\"/Konto/Zaloguj" + addReturnUrl + "\">Zaloguj się</a>"; } else { if (Request.RawUrl.Contains("/Konto/") || Request.RawUrl.Contains("/Admin/") || Request.RawUrl.Contains("/Permission")) { addReturnUrl = ""; } R += "<a href=\"/Konto/\">Moje Konto</a>"; int MSaccount = usr.IsMSAccount ? 1 : 2; if (!String.IsNullOrEmpty(addReturnUrl)) { addReturnUrl = "&" + addReturnUrl.Substring(1); } R += "<li><a href=\"/Konto/webauth?logout=" + MSaccount.ToString() + addReturnUrl + "\">Wyloguj</a></li>"; } return(R); }
protected void btnAdminTake_Click(object sender, EventArgs e) { try { JITAD.UserSystem sys = new JITAD.UserSystem(); JITAD.User u = sys.SetAdmin(txtAdminTake.Text, false); if (((JITAD.User)Session["CurrentUser"]).UserName == txtAdminTake.Text) { Session["CurrentUser"] = u; } txtAdminTake.Text = ""; lblSuccess.Visible = true; } catch (Exception ex) { lblError.Text = ex.Message; lblError.Visible = true; } }