我以系统帐户登录,因此它可能不是“真正的访问被拒绝”! 我所做的: - 自定义主页 - 从一个自定义的内容类型的自定义页面布局(自定义字段)Sharepoint:编辑页面(由于页面布局)或列表项目时拒绝访问
如果我在SPD的工具添加自定义字段(又名“内容字段” )在我的页面布局中,当我尝试编辑来自该页面布局的页面时,我的访问被拒绝。
因此,举例来说,如果我在页面布局加上此行的“ASP:内容”标签: 我得到拒绝访问。如果我删除它,everyting很好。 (“测试”字段是来自内容类型的字段)。
有什么想法?
UPDATE
嗯,我想在一个空白的网站,它工作得很好,所以一定是坏了我的web应用程序:(
更新#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 **
OK ......我想,我发现网页上面(见链接)的代码,它似乎解决的事情。我还没有在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天的那个bug)
对我来说,它发生在从另一个网站定义(cmp文件)导入后
实际上,它应该是一个已知的bug,它应该从2009年2月开始被修复,但它看起来不是。
我在上面发布的代码应该修复这个问题。
我使用MOSS 2K7的方式 – tinky05 2010-01-14 15:08:18
和 http://social.technet.microsoft.com/Forums/en-CA/sharepointgeneral/thread/4d0578f8-f6f2-480a-8a63-737ac102cf98 也 – tinky05 2010-01-20 18:17:28