Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void RemoveCookiesAndRedirect()
- {
- string ipUrl = GetIPUrl();
- //if (ipUrl != string.Empty)
- //{
- string replyUrl = HttpUtility.UrlEncode(SPContext.Current.Site.RootWeb.Url);
- string redirect = ipUrl + "?wa=wsignout1.0&wreply=" + replyUrl;
- try
- {
- FederatedAuthentication.SessionAuthenticationModule.SignOut();
- if (Context.Session != null) Context.Session.Abandon();
- Context.Response.Redirect(redirect);
- //}
- }
- catch (Exception ex)
- {
- LoggingService.LogError("LoginRedirect", ex.Message + " " + ex.InnerException + " " + ex.Data + " ipUrl:" + ipUrl + " redirect:" + redirect);
- }
- }
- private string GetIPUrl()
- {
- IClaimsPrincipal user = Page.User as IClaimsPrincipal;
- if (user == null) return string.Empty;
- string ipUrl = string.Empty;
- try
- {
- string providerName = (user.Identity.Name).Split('|')[1];
- ipUrl = SPSecurityTokenServiceManager.Local.TrustedLoginProviders[providerName].ProviderUri.AbsoluteUri;
- }
- catch
- {
- //TODO:Log it
- }
- return ipUrl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement