Andre's Blog

Personal blog of Andre Perusse

ASP.NET Sites and SharePoint Servers - A Match Made in Hell

If you've installed SharePoint Services (2003 or 2007) on your web server, you will likely find that many of your ASP.NET sites no longer work properly or at all. Even if the ASP.NET is not in the "managed path" of the SharePoint server, it still causes extreme grief. I had hoped that this would be "fixed" in the 2007 release of SharePoint, but apparently it is not.

To get around the problem, you can start with this Knowledgebase Article:

How to enable an ASP.Net application to run on a SharePoint virtual server

which basically tells you to reset the <trust> level to "Full" and re-add all the standard ASP.NET httpModules and httpHandlers. Nice - this is always what I wanted to do just to get my damn sites working again. Notably missing from this article, however, is the new ASP.NET 2.0 "Profile" feature, which also uses an HttpModule to automatically link a profile with the currently authenticated user. If you're using the Profile feature on your site, be sure to also add this line to your <httpModules> section:

<add name="Profile" type="System.Web.Profile.ProfileModule" />

Hopefully this little tidbit of information will save you the half-a-day of grief I just spent tracking down an "object reference not set to an instance of an object" error when trying to access the Profile object. I knew it was likely a SharePoint issue, but I danced all around the web.config before I was able to figure it out.

Loading