我最近开始编写用于 SharePoint 的 AJAX Web 部件,但遇到了一个奇怪的错误。似乎 EnsurePanelFix() 导致 Web 部件抛出 401 错误;在日志中,401.2 和 401.3 错误几乎同时出现。在对这里和其他一些站点进行了一些研究后,我对 EnsurePanelFix() 进行了一些更改,目前如下:
void EnsurePanelFix
{
// Change AJAX doPostBack behavior to fix the update panel.
if (this.Page.Form != null)
{
String fixupScript = @"
if (typeof(_spBodyOnLoadFunctionNames) !== 'undefined'){
_spBodyOnLoadFunctionNames.push(""_initFormActionAjax"");
function _initFormActionAjax() {
if (_spEscapedFormAction == document.forms[0].action){
document.forms[0]._initialAction =
document.forms[0].action;
}
}
RestoreToOriginalFormAction = function() {
if (_spOriginalFormAction != null) {
if (_spEscapedFormAction==document.forms[0].action){
document.forms[0].action=_spOriginalFormAction;
}
_spOriginalFormAction=null;
_spEscapedFormAction=null;
document.forms[0]._initialAction = document.forms[0].action;
}
};
}";
string scriptKey = "UpdatePanelFixup";
if (!Page.ClientScript.IsClientScriptBlockRegistered(scriptKey))
ScriptManager.RegisterStartupScript(this, typeof(SpecDatabaseViewer), scriptKey, fixupScript, true);
ScriptManager.RegisterStartupScript(this,
typeof(SpecDatabaseViewer), "UpdatePanelFixup",
fixupScript, true);
}
观察安全日志,我看到失败是这样记录的:
Event Type: Failure Audit
Event Source: Security
Event Category: Object Access
Event ID: 560
Date: 1/6/2010
Time: 11:46:34 AM
User: NT AUTHORITY\NETWORK SERVICE
Computer: SHAREPOINT
Description:
Object Open:
Object Server: SC Manager
Object Type: SERVICE OBJECT
Object Name: WinHttpAutoProxySvc
Handle ID: -
Operation ID: {0,69477107}
Process ID: 404
Image File Name: C:\WINDOWS\system32\services.exe
Primary User Name: SHAREPOINT$
Primary Domain: SPDOMAIN
Primary Logon ID: (0x0,0x3E7)
Client User Name: NETWORK SERVICE
Client Domain: NT AUTHORITY
Client Logon ID: (0x0,0x3E4)
Accesses: Query status of service
Start the service
Query information from service
Privileges: -
Restricted Sid Count: 0
Access Mask: 0x94
有多个失败审计,它们之间唯一不同的数据是操作 ID。
鉴于没有这段代码一切正常,任何人都可以看到我会遇到身份验证或文件权限问题的任何原因吗?谢谢。
编辑:我很确定它与 ACL 有关,但我不确定在哪里寻找可能导致问题的资源。