MCMS: GetByGuid throws COMException (“Server Error”)

August 5th, 2008 by Xerxes Leave a reply »

In (the now famous) Project P, working with Microsoft CMS’s security model had me ripping my hair out.

Whenever I made a call to the context.Searches.GetByGuid() method, the system would throw a COMException, citing the quite unhelpful message “Server Error. Please contact your administrator”

For future reference (in case anyone comes across this themselves) the problem was caused because the GUID i was passing into the application was not formatted in the correctly for what CMS was expecting.

My code was doing:
string inputGuid = myGuid.ToString();

But it turns out it actually needed to be:
string inputGuid = myGuid.ToString(“B”);

The difference (according to MSDN) is that .ToString() with no overload assumes the format identifier of “D” which results in a GUID formatted without curly braces. Format “B” provides the same guid string but with curly braces.

Why this needed to throw a “Server error” exception, is beyond me. A simple ArgumentException would have sufficed, or better still it could take in a Guid as the parameter instead of a string.

For a blow-by-blow account of this problem, visit my newsgroup post about UserHasRightToBrowse Always Returns True

Bookmark this post:
  • DotNetKicks
  • DZone
  • TwitThis
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Live
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati

Related posts:

  1. HttpException (0×80004005): Server Too Busy Recent problems with a client website have required me to...
  2. DateTime.Parse() is locale sensitive The DateTime.Parse() method (and all its derivatives, i assume) are...
  3. MissingMethodException: ? Sometimes though when you’re changing interfaces across several projects, you...
  4. Happy Birthday (The C-Sharp way) This evening I wanted to wish someone a happy birthday....
  5. Upgrading Database Schema’s in .NET This post is the first what I intend to be...

Comments are closed.