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