Fixing the Elusive “Value Cannot Be Null FBA Authentication Error

This error occurs promptly after a user logins via FBA (regardless of provider), and will materialize after indiscriminate time increments that are challenging to wrap with any empirical values. I looked all over the place to see if anyone else had hit this error, and while they had none had a repair in place. This is what the error looks like:

(view larger image)

At first, I thought it was my login page that I use because I perform an assortment of executions post-authentication for external content requests (mostly auditing and user tracking). However, this wasn’t the case. I looked through all the pertinent web.config values, and everything looked in order. Looked through all the custom code since I saw some unreleased SPRequest objects (for shame Adam!) in the ULS logs, and at this point I was reaching (I had already disassembled the stack trace as much as possible, not much in there)…so I went and fixed all those. Still no effect.

Running out of ideas, I decided to go through any less commonly changed web.config values. Sure enough, I found that the batch compilation was explicitly disabled i.e. the debug attribute for the compilation element was set to true. This is actually pretty frequent in *development* environments because permits walking through SharePoint application page code calls (so that a reasonable debugging environment can be procured). However, in production this is bad. Realllllll bad. This is because when that is toggled in production every page requested builds a dynamic assembly (to support debugging) that get sprinkled all over the address space and fragment memory, causing bad exceptions, most notably out of memory ones.

I switched it back the debug attribute to false, and viola! Production is back to authentication goodness.


4 thoughts on “Fixing the Elusive “Value Cannot Be Null FBA Authentication Error”

  1. I just ran across your site, lots of great content.

    I have (had) the same issue with my custom membership provider for a long time and could never find information on it (loads of questions, no answers). It appears to have significantly improved the SharePoint performance in general.

    Great article. Thanks!

    On a side note. This article was very hard to find. I am not sure when this was published, but having the error text in the post would have made it crawl-able. I put it below to help other poor saps like me find your answer.

    Value cannot be null.
    Parameter name: value at System.String.EndsWith(String value, StringComparison comparisonType)
    at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PostAuthenticateRequestHandler(Object oSender, EventArgs ea)
    at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

  2. I am glad it worked!

    I am no SEO expert, so I am not shocked that the article didn’t come up :) Regardless, I am happy the provided approach was helpful!

  3. Hello again,

    This solution did not fix the problem; the solution appears to make it take longer for the issue to occur.

    SharePoint does not put anything in the Event Log or the SharePoint Log (ULS), so debugging this is incredibly difficult. Do you have any other ideas about how to track down the root cause of the issue?

    Thanks for your time.

  4. Hi,

    I faced the same problem today for my boss computer. I can access the sharepoint sites and checked with my colleague computers the sites worked fine.

    I changed the debug=false for all web.config’s. The error does not change then I asked my boss to remove all temporary files manually. Then it worked!

    As menionted here, may be some client side script problems.

Leave a Reply

Your email address will not be published. Required fields are marked *