Karim's profileMicrosoft Dynamics CRM B...PhotosBlogListsMore ![]() | Help |
|
June 17 SpSecurity.RunWithElevatedPrivileges() method Fails!!Hello everybody, I'm trying to create a site programmaticaly under the sharepoint portal by using the following code and it generates the following error : Microsoft.SharePoint.SPException was unhandled by user code Message="Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb." Source="Microsoft.SharePoint" ErrorCode=-2130243945 StackTrace: 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 _Default.<>c__DisplayClass1.<Page_Load>b__0() in c:\Microsoft Dynamics CRM CTP\RunwithelevSecurity\Default.aspx.cs:line 35 at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state) at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) ===================================================================== Here is my Code : SPGlobalAdmin globalAdmin = new SPGlobalAdmin(); globalAdmin.AllowUnsafeUpdates = true; Context.Items[SPGlobalAdmin.RequestFromAdminPort] = true; Page.RegisterHiddenField("__REQUESTDIGEST", globalAdmin.AdminFormDigest); SPSite elevatedSite = null; SPSecurity.RunWithElevatedPrivileges(delegate() { //Access the root site collection using (elevatedSite = new SPSite("http://localhost:1900/sites/Projects")) { SPWebCollection sites = elevatedSite.AllWebs; elevatedSite.AllowUnsafeUpdates = true; //Create the new Web using (SPWeb web = sites.Add("Project_Name", "Project_Title", "Project_Description", 1033, "STS#0", false, false)) { web.AllowUnsafeUpdates = true; Response.Redirect(web.Url.ToString()); } } }); Any help , I've searched many times, without any solution , the same error every time ?? Regards, Karim June 14 SQL Server 2008 KatMai - Your Data, Any Place, Any TimeIt was the first time anyone hear about the SQL Server KatMai in the first Microsoft BI Conference held in Washington DC the last month, I've attend a live webcast by David Campell
Share the SQL Server Future vision
I've installed the Katmai and tested some features in it , overall it's a very nice product and have a lot of enhancements than SQL Server 2005, but I've dissappointed in the enhancements of SSIS , they are not much , only one thing has been announced the "Data Capture Engine " which capture the data of insert , update , delete statments in the run time and change them, I've attended a Live chat on the Katmai couple a days ago and I've asked the experts If there is any major enhancements else in the SSIS and they generously ignored my questions.
Anyway, Microsoft has added major enhancements on the Reporting Services 2008 like the following :
and they are also reviewing the support of some of Dundas controls. Also there is major enhancements in the Analaysis services Data Mining and Multidimensional data. one of the cool features really in Katmai , is the location datatype and intelligent and spatial data type and I'll take about those two later and I'll accompany the blog with some code. Another nice feature also is the duplicate detection which detect the duplication in data when you import the data from a place to another. Of course there is major enhancements in the performance of the Data warehousing and the data auditing feature and a lot of other features that I'll explain in later posts. If there is anyone intrested in downloading the sql server he can access connect.microsoft.com website for participating in the testing program. Enjoy!! |
|
|