Je reçois la fameuse erreur « La validation de sécurité pour cette page est invalide. Cliquez sur Précédent ... » tout en créant des sites SharePoint à l'aide du modèle d'objet ...Erreur lors de la création d'un nouveau site sharepoint en utilisant le modèle d'objet sharepoint
C'est mon code dans la partie Web pour créer des sites de points de partage.
using (SPSite objSite = new SPSite(SPContext.Current.Site.ID))
{
objSite.AllowUnsafeUpdates = true;
using (SPWeb objWeb = objSite.OpenWeb(SPContext.Current.Web.ID))
{
objWeb.AllowUnsafeUpdates = true;
SPWeb NewWeb3 = null;
try
{
NewWeb3 = objSite.AllWebs.Add(RelativeITTURL, projectCode, SiteDescription, LocaleID, ITTSiteDefinitionTemplate, false, false);
NewWeb3.AllowUnsafeUpdates = true;
NewWeb3.Navigation.UseShared = true;
NewWeb3.BreakRoleInheritance(true);
NewWeb3.AllowUnsafeUpdates = true;
ITTSiteID = new Guid(NewWeb3.ID.ToString());
NewWeb3.Update();
NewWeb3.AllowUnsafeUpdates = false;
}
catch (Exception ex3)
{
StringBuilder Message = new StringBuilder();
Message.Append(string.Format("Error while creating the site for the 3rd time. '{0}/{1}'\n", _siteCollection, projectCode));
Message.Append(string.Format("Project Code: {0}\n", projectCode));
Message.Append(string.Format("ITT Site URL: {0}\n", FullITTSiteURL));
Message.Append(string.Format("Web Template: {0}\n", _webTemplate));
Message.Append(string.Format("Web Template To String: {0}\n", ITTSiteDefinitionTemplate.ToString()));
Message.Append(string.Format("Locale ID: {0}\n", LocaleID.ToString()));
//Message.Append(string.Format("Form digest validated: {0}\n", ValidateFormDigect.ToString()));
NFER.ErrorManagement.ErrorLog.LogErrorToEventLog(ex3, Message.ToString());
lblProvisionStatus.Text = "An error occurred while creating the site. Please close your browser and try again.";
return;
}
finally
{
//Since an error can occur
if (NewWeb3 != null)
NewWeb3.Dispose();
}
}
}
je reçois une erreur sur cette ligne
CurrentSite.AllWebs.Add...
Je peux créer des sites avec succès avec le compte système, mais avec un compte de test limité, il échoue. Ce qui est marrant, c'est que ça fonctionnait à un moment donné, mais maintenant ça ne l'est pas.
C'est la pile d'appel
Error Message: The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.
Error Source: Microsoft.SharePoint
Stack Trace: at Microsoft.SharePoint.Library.SPRequest.CreateWeb(String bstrUrl, String bstrTitle, String bstrDescription, UInt32 nLCID, String bstrWebTemplate, Boolean bCreateUniqueWeb, Boolean bConvertIfThere, Guid& pgWebId, Guid& pgRootFolderId, Boolean bCreateSystemCatalogs)
at Microsoft.SharePoint.SPSite.CreateWeb(String strUrl, String strTitle, String strDescription, UInt32 nLCID, String strWebTemplate, Boolean bCreateUniqueSubweb, Boolean bConvertIfThere, Guid webId, Guid rootFolderId, Boolean createSystemCatalogs)
at Microsoft.SharePoint.SPSite.SPWebCollectionProvider.CreateWeb(String strWebUrl, String strTitle, String strDescription, UInt32 nLCID, String strWebTemplate, Boolean bCreateUniqueSubweb, Boolean bConvertIfThere)
at Microsoft.SharePoint.SPWebCollection.Add(String strWebUrl, String strTitle, String strDescription, UInt32 nLCID, String strWebTemplate, Boolean useUniquePermissions, Boolean bConvertIfThere)
at Microsoft.SharePoint.SPWebCollection.Add(String strWebUrl, String strTitle, String strDescription, UInt32 nLCID, SPWebTemplate WebTemplate, Boolean useUniquePermissions, Boolean bConvertIfThere)
at ProjectManWebParts.ITTStage2DataCapture.<>c__DisplayClass3.<BtnProvisionITT_Click>b__0()
Target Site: Void CreateWeb(System.String, System.String, System.String, UInt32, System.String, Boolean, Boolean, System.Guid ByRef, System.Guid ByRef, Boolean)
Data Begin Information
Data End Information
Error Message: The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.
Error Source:
Stack Trace: at Microsoft.SharePoint.Library.SPRequestInternalClass.CreateWeb(String bstrUrl, String bstrTitle, String bstrDescription, UInt32 nLCID, String bstrWebTemplate, Boolean bCreateUniqueWeb, Boolean bConvertIfThere, Guid& pgWebId, Guid& pgRootFolderId, Boolean bCreateSystemCatalogs)
at Microsoft.SharePoint.Library.SPRequest.CreateWeb(String bstrUrl, String bstrTitle, String bstrDescription, UInt32 nLCID, String bstrWebTemplate, Boolean bCreateUniqueWeb, Boolean bConvertIfThere, Guid& pgWebId, Guid& pgRootFolderId, Boolean bCreateSystemCatalogs)
Target Site: Void CreateWeb(System.String, System.String, System.String, UInt32, System.String, Boolean, Boolean, System.Guid ByRef, System.Guid ByRef, Boolean)
Data Begin Information
Data End Information
Custom Error Message: Error while creating the site for the 3rd time.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
S'il vous plaît toute aide est vraiment apprécié.
Je reçois la même erreur si je commente cette ligne //CurrentWebApp.FormDigestSettings.Enabled = false; – iJK
Pouvez-vous créer des sites avec le même modèle de définition de site en utilisant la page standard "créer un site"? – axk
Tous les utilisateurs n'auront pas le droit de créer un site à l'aide de l'interface utilisateur de SharePoint. Ils ne peuvent donc pas effectuer d'actions sur le site -> Créer un site. Je suis sûr qu'en utilisant le compte système, je peux créer un site en utilisant le même modèle de site. Je suis surpris que cela fonctionne maintenant ... Quelque chose de funky se passe, nous ne savons pas quoi. – iJK