One of these days I had to do some bugfixing on a Sharepoint project which used the Microsoft.SharePoint.Linq.DataContext class.
While trying to access a SPList belonging to Site Collection another Site Collection I always had an “Invalid Url Exception” right from the contructor, and other times I had exceptions when accessing the objects.
var context = new DataContext(otherSiteColUrl);
The problem is that inside, the constructor, the URL is only taken into account if we have no HttpContext. If we do have one, the context URL (which means, the current site url) the custom url passed on the constructor is ignored.
Continue reading “[Sharepoint] – DataContext with custom URL” »