protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (SessionManager.Current != null)
{
// User has logged in from another page.
// Make sure the session (based on the cookie) is actually valid before redirecting
var userId = SessionManager.Current.User.UserName;
var sessionId = SessionManager.Current.User.SessionTokenId;
string[] authorityTokens;
if (SessionManager.VerifySession(userId, sessionId, out authorityTokens, true))
{
RedirectAfterLogin();
}
// session is invalid, looks like the web server and the authentication server are out of sync?
// To be safe, redirect user to the logout page
var originalRedirectUrl=SessionManager.GetRedirectUrl(SessionManager.Current);
var logoutUrl = string.Format(ImageServerConstants.PageURLs.LogoutPage, originalRedirectUrl);
Response.Redirect(Page.ResolveClientUrl(logoutUrl), true);
return;
}
if (!ServerPlatform.IsManifestVerified)
{
ManifestWarningTextLabel.Text = SR.NonStandardInstallation;
}
VersionLabel.Text = String.IsNullOrEmpty(ServerPlatform.VersionString) ? Resources.SR.Unknown : ServerPlatform.VersionString;
LanguageLabel.Text = Thread.CurrentThread.CurrentUICulture.NativeName;
CopyrightLabel.Text = ProductInformation.Copyright;
DataBind();
SetPageTitle(Titles.LoginPageTitle);
UserName.Focus();
}
}