1

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

0

I basically gave up and threw away what I had, starting over with http://davidlozzi.com/2011/07/15/sharepoint-2010-create-unique-login-page-with-forms-based-authentication/. 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.

  • 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 - MSFT Jan 15 '14 at 3:32
0

That error seems to occur when you attempt to use a CodeFile (aspx.cs) with a Page that inherits from Microsoft.SharePoint.IdentityModel.Pages.MultiLogonPage.

The error doesn't come up when you use compiled code or use CodeBehind and place the aspx.cs page in the App_Code directory.

You can also get rid of the error by removing base.Onload() from your overrided OnLoad method.

 protected override void OnLoad(EventArgs e)
    {
        //base.OnLoad(e);
    }

If you do this, the page title and text in front of the drop down list asking you to select an authentication method does not show up.

However, the drop down list is still added to the page and is still functional.

The MultiLogonPage is meant for allowing the user to select from a drop down list of login types and forward the user to the appropriate login type based off the postback from the drop down list.

Not quite sure why the error only occurs when trying to use a CodeFile, but there are ways to get it working, as I mentioned.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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