2012-11-07 45 views
3

我們正在運行SharePoint 2010服務器場。我已從用戶組中刪除了對網站集「供應商」的所有訪問權限。 「提供者」是用戶登錄到的默認站點集合。 我們有一個自定義訪問被拒絕的頁面,它繼承自「UnsecuredLayoutsPageBase」並且有一個擁有spwebpartmanager的主頁面。System.UnauthorizedAccessException與SPWebpartmanager

<WebPartPages:SPWebPartManager ID="m" runat="Server" /> 

現在,當從時,SharePoint重定向到AccessDeniedPage不訪問「提供者」日誌組的用戶。但SPWebPartManager(使用.net反射器進行檢查)會拋出System.UnauthorizedAccessException:嘗試執行未經授權的操作,因爲登錄的用戶沒有權限。

有沒有辦法用提升的權限運行spwebpartmanager?除了SPSecurity.RunWithElevatedPrivileges塊之外,我找不到任何東西,但可以與用戶代碼一起使用。我如何使OTB代碼以提升的權限運行?任何幫助深表感謝。謝謝。

這裏是堆棧跟蹤。

System.UnauthorizedAccessException: Attempted to perform an unauthorized operation. 
    at Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied(HttpContext context) 
    at Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied(Exception ex) 
    at Microsoft.SharePoint.Library.SPRequest.OpenWeb(String bstrUrl, String& pbstrServerRelativeUrl, String& pbstrTitle, String& pbstrDescription, String& pbstrTitleResourceId, String& pbstrDescriptionResourceId, Guid& pguidID, String& pbstrRequestAccessEmail, UInt32& pwebVersion, Guid& pguidScopeId, UInt32& pnAuthorID, UInt32& pnLanguage, UInt32& pnLocale, UInt16& pnTimeZone, Boolean& bTime24, Int16& pnCollation, UInt32& pnCollationLCID, Int16& pnCalendarType, Int16& pnAdjustHijriDays, Int16& pnAltCalendarType, Boolean& pbShowWeeks, Int16& pnFirstWeekOfYear, UInt32& pnFirstDayOfWeek, Int16& pnWorkDays, Int16& pnWorkDayStartHour, Int16& pnWorkDayEndHour, Int16& pnMeetingCount, Int32& plFlags, Boolean& bConnectedToPortal, String& pbstrPortalUrl, String& pbstrPortalName, Int32& plWebTemplateId, Int16& pnProvisionConfig, String& pbstrDefaultTheme, String& pbstrDefaultThemeCSSUrl, String& pbstrThemedCssFolderUrl, String& pbstrAlternateCSSUrl, String& pbstrCustomizedCssFileList, String& pbstrCustomJSUrl, String& pbstrAlternateHeaderUrl, String& pbstrMasterUrl, String& pbstrCustomMasterUrl, String& pbstrSiteLogoUrl, String& pbstrSiteLogoDescription, Object& pvarUser, Boolean& pvarIsAuditor, UInt64& ppermMask, Boolean& bUserIsSiteAdmin, Boolean& bHasUniquePerm, Guid& pguidUserInfoListID, Guid& pguidUniqueNavParent, Int32& plSiteFlags, DateTime& pdtLastContentChange, DateTime& pdtLastSecurityChange, String& pbstrWelcomePage, Boolean& pbOverwriteMUICultures, Boolean& pbMUIEnabled, String& pbstrAlternateMUICultures, Int32& puiVersion, Int16& pnClientTag) 
    at Microsoft.SharePoint.SPWeb.InitWeb() 
    at Microsoft.SharePoint.SPWeb.get_WebTemplate() 
    at Microsoft.SharePoint.SPWeb.get_WebTemplateConfiguration() 
    at Microsoft.SharePoint.WebControls.ScriptLink.InitJs_Register(Page page) 
    at Microsoft.SharePoint.WebControls.ScriptLink.RegisterForControl(Control ctrl, Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language) 
    at Microsoft.SharePoint.WebControls.ScriptLink.Register(Page page, String name, Boolean localizable, Boolean defer, Boolean loadAfterUI, String language, String uiVersion) 
    at Microsoft.SharePoint.WebControls.ScriptLink.RegisterOnDemand(Page page, String strKey, String strFile, Boolean localizable) 
    at Microsoft.SharePoint.WebControls.ScriptLink.OnLoad(EventArgs e) 
    at System.Web.UI.Control.LoadRecursive() 
    at System.Web.UI.Control.LoadRecursive() 
    at System.Web.UI.Control.LoadRecursive() 
    at System.Web.UI.Control.LoadRecursive() 
    at System.Web.UI.Control.LoadRecursive() 
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
+0

如果您使用開箱即用母版頁,它可以正常工作嗎?您確定所有內容,包括自定義母版頁都已簽入併發布嗎? –

回答

0

我建議沒有它的Web部件經理創建一個不同的母版頁。 。

0

我們遇到了與頁,當未登錄用戶運行基於表單的標誌類似的問題

爲了解決這個問題,我們必須從切換@Page指令:

DynamicMasterPageFile="~masterurl/default.master" 

MasterPageFile="~/_layouts/simple.master" 

這是相當確定原因是一個挑戰;必須用try/catch塊覆蓋PrcessRequest(),然後查看InnerException以獲得線索是什麼導致了該問題,因爲在/_login/OurLoginPage.aspx中它隱藏在403錯誤之下,並且只在堆棧跟蹤的深處發現了您在上面討論的問題。

相關問題