Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
Last active January 25, 2016 17:45
Show Gist options
  • Save ciphertxt/14dccf9033af83a39a29 to your computer and use it in GitHub Desktop.
Save ciphertxt/14dccf9033af83a39a29 to your computer and use it in GitHub Desktop.
Updates an AD FS 2.0 Login page (FormsSignin.aspx) to autopopulate the user name and set the password focus. * http://mikepfeiffer.net/2012/05/useful-cutomizations-to-ad-fs-2-0-when-deploying-sso-with-office-365/ * https://msdn.microsoft.com/en-us/library/ee895357.aspx
protected void Page_Load( object sender, EventArgs e )
{
if (!this.IsPostBack)
{
// Extract the username fromt he query string and set the username TextBox
string url = Context.Request.Url.AbsoluteUri;
System.Collections.Specialized.NameValueCollection parameters = System.Web.HttpUtilitiy.ParseQueryString(url);
string userName = parameters["username"];
if (!String.IsNullOrEmpty(userName))
{
UsernameTextBox.Text = userName;
PasswordTextBox.Focus();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment