SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

Source Error:

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.

Stack Trace:

[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 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.

share|improve this question
up vote 0 down vote accepted

I basically gave up and threw away what I had, starting over with The key I think is inheriting from the Forms sign-in page, but that's still squirrelly. I'd rather know exactly what that class is doing that lets it work but I don't have time to dig into it and replicate it.

share|improve this answer
To clarify a little: eventually, I ended up inheriting from IdentityModelSignInPageBase, which seemed to work well and solved some weirdness in Office clients that occurred if I used UnsecuredLayoutsPageBase or Page. – MikeBaz Jan 15 '14 at 3:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.