Friday 12 January 2007

Errors Switching to Edit Site Mode in CMS 2002

Apologies for using images to display code snippets. Blogger is not quite there yet, and strangely it conplains when you add a script tag in your blog post ;)

Up until now whenever a colleague or client tells me that they can't switch to "edit site mode" in CMS 2002 I've always immediately answered it with - "you've forgotten to and the CMS sub directory to your web application. And until now I've been 100% right. Today I found a new possibility. So, to recap here are both known solutions to the "switch to edit site mode" error, normally aparrent if the URL looks like the following

http://mysite/page.htm#

it's the trailing # that idicates the problem

Solution 1 - No id attribute on your form

CMS 2002 generates javascript (which I always process out of public view pages - why add 15K unusuable inaccessible overhead to every public view of a page) to handle the switching of its menu mode, one of which usually looks like this:



You'll find it just under the viewstate tag. If you somehow don't have an id attribute on your form however ie:



instead of the expected



Then you'll find that the CMS javascript generated is


..and this will give you an javascript error in the console when you try to switch mode. Incidentally if you use master pages you will find that the javascript generated is different. Having talked through the newsgroups to those that know (ie Stefan Gossner) - it appears that this may be a slightly undocumented "feature" of CMS2002 for VS2005. Worth paying attention to if you like to clean up unecessary scripts like I do.

Solution 2 - Missing CMS virtual directory in IIS

This is by far the most common, and often happens if you deploy your web app manually, mostly AFTER enabling a site for CMS in the SCA

Both your web application and the MCMS application underneath your website should contain a virtual directory called CMS. If you do not and you experience the problem mentioned you can take the steps below. I say only if, because IIS 5 has a habit of hiding the virtual directory in the IIS MMC plugin. To be certain, use IIS metabase Edit to see the real story.

To add the directory:

  1. In IIS, underneath your web application, create a new virtual directory called CMS
  2. point it at c:\program files\microsoft content management server\server\IIS_CMS
  3. ensure that only read access is ticked. Do not tick run scripts
  4. complete the wizard
  5. go back into the properties of the virtual directory and change the execute permissions to scripts only

refreshing your web page should not allow you to switch between site modes. It's a strange quirk, but enabling the run scripts option during the wizard itself always leads to failure (certainly on IIS 5). I have no idea why, but it to some finding out. Fortunately this is the default selection in IIS 6, so you are less likely to accidently set it.

3 comments:

  1. Look here for syntax highlighting in blogger:)
    http://blog.the-dargans.co.uk/2007/01/syntax-highlighting-in-blogger.html

    ReplyDelete
  2. Thank you very much

    you helped me not breaking the computer

    ReplyDelete
  3. 73680.....55105

    ReplyDelete