我以系统帐户登录,因此可能不是“真正的访问被拒绝”! 我做了什么: - 自定义母版页 - 自定义内容类型(包含自定义字段)的自定义页面布局
如果我在页面布局中添加自定义字段(在SPD中的工具中称为“内容字段”),当我尝试编辑来自该页面布局的页面时,我会拒绝访问。
所以,例如,如果我在“asp:content”标签中添加我的页面布局这一行: 我被拒绝访问。如果我删除它,一切都很好。 (字段“test”是来自内容类型的字段)。
有什么想法吗?
更新
好吧,我尝试了一个空白网站并且工作正常,所以我的网络应用程序肯定有问题:(
更新#2
看起来母版页中的这一行给了我拒绝访问权限:
<SharePoint:DelegateControl runat="server" ControlId="PublishingConsole" Visible="false"
PrefixHtml="<tr><td colspan="0" id="mpdmconsole" class="s2i-consolemptablerow">"
SuffixHtml="</td></tr>"></SharePoint:DelegateControl>
更新#3
看起来像是一个类似的问题。但我们的Sharepoint版本包含最新更新。我将尝试使用应该修复列表的代码并发布另一个更新。
**更新#4 **
好的......我尝试了上面页面上找到的代码(参见链接),似乎解决了这个问题。我没有100%测试解决方案,但到目前为止,非常好。这是我为功能接收器编写的代码(我使用了上面链接中发布的代码):
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using System.Xml;
namespace MyWebsite.FixAccessDenied
{
class FixAccessDenied : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
FixWebField(SPContext.Current.Web);
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
//throw new Exception("The method or operation is not implemented.");
}
public override void FeatureInstalled(SPFeatureReceiverProperties properties)
{
//throw new Exception("The method or operation is not implemented.");
}
public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
{
//throw new Exception("The method or operation is not implemented.");
}
static void FixWebField(SPWeb currentWeb)
{
string RenderXMLPattenAttribute = "RenderXMLUsingPattern";
SPSite site = new SPSite(currentWeb.Url);
SPWeb web = site.OpenWeb();
web.AllowUnsafeUpdates = true;
web.Update();
SPField f = web.Fields.GetFieldByInternalName("PermMask");
string s = f.SchemaXml;
Console.WriteLine("schemaXml before: " + s);
XmlDocument xd = new XmlDocument();
xd.LoadXml(s);
XmlElement xe = xd.DocumentElement;
if (xe.Attributes[RenderXMLPattenAttribute] == null)
{
XmlAttribute attr = xd.CreateAttribute(RenderXMLPattenAttribute);
attr.Value = "TRUE";
xe.Attributes.Append(attr);
}
string strXml = xe.OuterXml;
Console.WriteLine("schemaXml after: " + strXml);
f.SchemaXml = strXml;
foreach (SPWeb sites in site.AllWebs)
{
FixField(sites.Url);
}
}
static void FixField(string weburl)
{
string RenderXMLPattenAttribute = "RenderXMLUsingPattern";
SPSite site = new SPSite(weburl);
SPWeb web = site.OpenWeb();
web.AllowUnsafeUpdates = true;
web.Update();
System.Collections.Generic.IList<Guid> guidArrayList = new System.Collections.Generic.List<Guid>();
foreach (SPList list in web.Lists)
{
guidArrayList.Add(list.ID);
}
foreach (Guid guid in guidArrayList)
{
SPList list = web.Lists[guid];
SPField f = list.Fields.GetFieldByInternalName("PermMask");
string s = f.SchemaXml;
Console.WriteLine("schemaXml before: " + s);
XmlDocument xd = new XmlDocument();
xd.LoadXml(s);
XmlElement xe = xd.DocumentElement;
if (xe.Attributes[RenderXMLPattenAttribute] == null)
{
XmlAttribute attr = xd.CreateAttribute(RenderXMLPattenAttribute);
attr.Value = "TRUE";
xe.Attributes.Append(attr);
}
string strXml = xe.OuterXml;
Console.WriteLine("schemaXml after: " + strXml);
f.SchemaXml = strXml;
}
}
}
}
只需将该代码作为功能接收器,并在根站点激活它,它应该遍历所有子站并修复列表。
概要
编辑 PAGE 或 ITEM 时,您会收到拒绝访问
即使你是以世界f ****的超级管理员身份登录,你仍然会收到错误(抱歉,我花了3天时间来处理该错误)
对我来说,它发生在从另一个网站定义(cmp文件)
导入之后实际上,它应该是一个已知的错误,它应该在2009年2月以后修复,但它看起来不是。
我上面发布的代码应该解决这个问题。
答案 0 :(得分:0)
尝试发布您的MasterPage和Page Layouts,这是最常见的原因。由于系统帐户是godmode,因此不会出现错误。
在SharePoint Designer中,您无法执行发布工作流程(批准)中的最后一步,因此您:
SharePoint Designer:
CheckIn =&gt;发布主要版本,点击确定按钮或转到网站上的/ _catalogs / masterpage。
然后使用上下文菜单批准MasterPage和布局。
答案 1 :(得分:0)
一些想法:
答案 2 :(得分:0)
请参阅我在帖子编辑中发布的代码。它解决了我的问题。
答案 3 :(得分:0)
问题似乎是由某些版本的SharePoint stsadm -o export
函数中的错误引起的(我从2007 RTM MOSS服务器导出它)。导入伪造导出文件会导致所有NEWLY-CREATED列表中出现“edit-denied-access”问题。来自Microsoft的更高版本的修补程序修复了stsadm -o export
,但是不要修复损坏的列表;这需要像 tinky05 这样的程序。