You receive a "current user does not have rights to edit the requested item" error message when you save a Web page on Microsoft Content Management Server 2002 (873203)
The information in this article applies to:
- Microsoft Content Management Server 2002
SYMPTOMSWhen you are logged on as an Author to a Microsoft Content Management Server (MCMS) 2002 Web site, you may receive an error message that is similar to the following when you try to save a Web page:
The current user does not have rights to edit the requested item. If you are seeing this exception when a MCMS template is executing, it means that you have removed the CmsAuthorizationModule from the HttpModules section of your web.config. You can only remove this module if: 1. All requests for every MCMS template in the web application will only be accessed by anonymous users 2. Guest access is enabled in MCMS (via the SCA) 3. The MCMS guest user has access to all postings based on templates in the web application If any of these requirements are not met, you MUST register the CmsAuthorizationModule in your web.config.
CAUSEThis problem may occur if you save a Web page that contains a reference to an item that has been deleted from the MCMS Resource Gallery.
Generally, this problem may occur if the MCMS Web site is managed by multiple users in a large organization. For example, when a resource gallery manager deletes an item from the MCMS Resource Gallery, and the Web page that contains the reference to the deleted item is not updated, an author who tries to save any changes that have been made to that Web page receives the error message that is mentioned in the "Symptoms" section. WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To work around this problem, add the following Microsoft Visual C# code to the Global.asax.cs file on the computer that is running MCMS. When you do this, the MCMS workflow is updated automatically to remove any references to items that have been deleted from the Resource Gallery on the MCMS Web site. To add the VBS code to the Global.asax.cs file, follow these steps: - On the computer that is running MCMS, locate the following folder:
Drive:\Inetpub\wwwroot\YourWebSite - Right-click Global.asax.cs, click Open With, and then click Notepad.
- In Notepad, click Find on the Edit menu.
- In the Find dialog box, type #region Methods, and then click Find Next.
- Press ENTER to add a line space after the line that you located in step 4, and then paste the following VBS code.
//=====================================================================
// Method: DeletedResource(string link)
//
/// <summary>
///
/// This method removes references to deleted items in the Resource Gallery.
/// </summary>
//=====================================================================
private bool DeletedResource(string link)
{
// Extract the Resource GUID from the URL.
string[] splt = link.Split('/');
string GUID = splt[3];
// Create a new context that has administrator rights to see deleted items.
CmsApplicationContext appContext = new CmsApplicationContext();
appContext.AuthenticateAsUser("WinNT://servername/cmsAdmin", "cmsAdminPassword", PublishingMode.Unpublished);
object o = appContext.Searches.GetByGuid("{"+GUID+"}");
// Test whether the item can be deleted.
bool isDeleted= false;
if (o != null)
{
isDeleted = ((o is Resource) & (((Resource)o).Path.StartsWith("/Archive Folder")));
}
// Dispose of the admin context.
appContext.Dispose();
appContext = null;
// Return the result.
return isDeleted;
}
private static int FindTag(string text, string tag, int start, string recursecompare)
{
int pos = text.ToLower().IndexOf(tag.ToLower(),start);
int check = text.ToLower().IndexOf(recursecompare.ToLower(),start+1);
if ((check >= 0) & (check < pos))
{
check = FindTag(text,tag,check,recursecompare);
pos = text.ToLower().IndexOf(tag.ToLower(), check+1);
}
return pos;
}
private static string RemoveTagPair(string text, string tag, string endtag, string recursecompare)
{
int start = text.ToLower().IndexOf(tag.ToLower());
int end = -1;
while (start >= 0)
{
end = FindTag(text,endtag,start,recursecompare);
if (end > start)
text = text.Remove(end,endtag.Length);
text = text.Remove(start,tag.Length);
start = text.ToLower().IndexOf(tag.ToLower());
}
return text;
}
private string HandleImgAndAttPlaceholderTypes(string propValue)
{
if (propValue.ToLower().StartsWith("/nr/rdonlyres"))
{
if (DeletedResource(propValue))
{
propValue = ""
}
}
return propValue;
}
private string HandleImageTags(string propValue)
{
int start=propValue.ToLower().IndexOf("<img ");
while (start >= 0)
{
int end = propValue.IndexOf(">",start);
if (end > start)
{
string tag = propValue.Substring(start,end-start+1);
int linkStart = tag.ToLower().IndexOf("\"/nr/rdonlyres");
if (linkStart >= 0)
{
int linkEnd = tag.IndexOf("\"",linkStart+1);
if (linkEnd > linkStart)
{
string linkStr = tag.Substring(linkStart,linkEnd-linkStart+1);
if (DeletedResource(linkStr))
{
propValue = propValue.Replace(tag,"");
tag = ""
}
}
}
start = propValue.ToLower().IndexOf("<img ",start+tag.Length);
}
}
return propValue;
}
private string HandleAnchorTags(string propValue)
{
int start=propValue.ToLower().IndexOf("<a ");
while (start >= 0)
{
int end = propValue.IndexOf(">",start);
if (end > start)
{
string tag = propValue.Substring(start,end-start+1);
int linkStart = tag.ToLower().IndexOf("\"/nr/rdonlyres");
if (linkStart >= 0)
{
int linkEnd = tag.IndexOf("\"",linkStart+1);
if (linkEnd > linkStart)
{
string linkStr = tag.Substring(linkStart,linkEnd-linkStart+1);
if (DeletedResource(linkStr))
{
propValue = RemoveTagPair(propValue,tag,"</a>","<a");
tag = ""
}
}
}
start = propValue.ToLower().IndexOf("<a ",start+tag.Length);
}
}
return propValue;
}
public void CmsPosting_PlaceholderPropertyChanging( Object sender, PropertyChangingEventArgs e )
{
string propName = e.PropertyName;
string propValue = e.PropertyValue as string;
switch (propName)
{
case "Html" : // handle HtmlPlaceholder
ropValue = HandleImageTags(propValue);
propValue = HandleAnchorTags(propValue);
break;
}
case "Src" : // handle ImagePlaceholder
case "Url" : // handle AttachmentPlaceholder
{
propValue = HandleImgAndAttPlaceholderTypes(propValue);
break;
}
}
e.PropertyValue = propValue;
} - Save your changes, and then close the file.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Modification Type: | Minor | Last Reviewed: | 9/15/2006 |
---|
Keywords: | kbprb KB873203 kbAudEndUser kbAudDeveloper |
---|
|