protected void Page_Load(object sender, EventArgs e) { string login = Request["login"]; string logout = Request["logout"]; string returnUrl = Request["ReturnUrl"]; if (login != null) { string[] scopes = new string[] { "wl.signin", "wl.basic" }; string loginUrl = liveAuthClient.GetLoginUrl(scopes, "https://jitad2015.waw.pl/Konto/webauth"); Response.Redirect(loginUrl, true); } if (logout != null) { if (returnUrl != null) { returnUrl = "&ReturnUrl=" + returnUrl; } string logoutUrl = "https://jitad2015.waw.pl/Konto/webauth?l=1" + returnUrl; if (logout == "2") { goto noneMS; } logoutUrl = liveAuthClient.GetLogoutUrl("https://jitad2015.waw.pl/Konto/webauth?l=1" + returnUrl); liveAuthClient.ClearSession(new HttpContextWrapper(Context)); noneMS: Session.Abandon(); Response.Redirect(logoutUrl, true); } if (Request["l"] != null) { if (returnUrl != null) { Response.Redirect("~/" + returnUrl, true); } else { Response.Redirect("~/", true); } } RegisterAsyncTask(new PageAsyncTask(getAuthResult)); }