I'm trying to create a custom logon page for SharePoint 2013. I have an existing 2010 project that works fine that I'm using as a model for a 2013 version, but I can't get it to work.
What has worked is making my own empty page that is based on MultiLogonPage, but I am trying to do a merged login page (form, Windows redirect, etc.). And it seems that inheriting from the existing page has a lot of restrictions. In particular any kind of major codebehind leads to:
Operation is not valid due to the current state of the object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Operation is not valid due to the current state of the object.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[InvalidOperationException: Operation is not valid due to the current state of the object.]
Microsoft.SharePoint.IdentityModel.Pages.MultiLogonPage.OnLoad(EventArgs e) +1118 System.Web.UI.Control.LoadRecursive() +95
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2936
It's not a web.config issue, because that is set to allow all users on the login page.
I'm clearly missing something in the basic setup but I don't know what.
It certainly seems from places like http://davidlozzi.com/2011/07/15/sharepoint-2010-create-unique-login-page-with-forms-based-authentication/ that this is pretty simple...
Everything is in the default zone right now so it's not anything around that. The login page is set correctly for the web application because the redirect to the login page is happening.