-
10-12-2019 - |
题
我正在尝试通过网站上的控件在Page_load中创建SPWeb。我收到错误“此页面的安全验证无效”。
我有一个回发(没有get-prequest),也尝试了sputility.validateformdigest在oninit-method中,直接在runWithElevatePrivileagues之前。
我已经在我的控件的ASCX上放置了一个FormDigest控件。母版页是西雅图.Master并包含FormDigeStpleCE持有人和控件。
它在具有农场帐户的DEV系统上工作,但不在集成系统上。我在SP2013。
任何建议?
[更新2] 确定更新1中的代码不是真正的问题。以下行中发生的实际问题:
.
在Page_Load中,我注册了此代码以将站点提交到自身以获取回发。但是在回发和控制完全加载后,页面正在其他地方获得安全验证错误(不在我的代码中)。任何建议?
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CreateMeetingRepost", "document.forms[0].submit();", true);
我想做的就是创建一个subsite。我在rootweb和网站上尝试了allowunsafeupdate,但这并不起。 SharePoint将ContentType复制到新Web时抛出InnerException。
[更新 - 不是问题] 一些代码 - 会议manager.createmeetingandfleflem创建子站点
.SPSecurity.RunWithElevatedPrivileges(() =>
{
using (SPSite elevatedSite = new SPSite(SPContext.Current.Site.ID))
{
using (SPLongOperation operation = new SPLongOperation(this.Page))
{
operation.LeadingHTML = "Meeting wird erstellt";
operation.Begin();
MeetingManager.CreateMeetingAndFillUrl(elevatedSite, currentMeeting);
try
{
operation.End(currentMeeting.Url);
}
catch (ThreadAbortException)
{
// This exception is thrown because the SPLongOperation.End
// calls a Response.End internally
// see: http://dotnetfollower.com/wordpress/2011/08/sharepoint-how-to-use-splongoperation/
}
}
}
});
解决方案
I found the problem. All the code is correct but there is an error in March 2013 PU. The FormDigest is set invalid and when doing a post the error occures. This is a real bad error.