SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote a ASP.NET Handler module for sharepoint 2010 web application. it is running .But I added this code, occured error Code:

string tema = "/_catalogs/theme/Classic.thmx";
ThmxTheme tm = ThmxTheme.Open(SPContext.Current.Site, tema);
ThmxTheme.SetThemeUrlForWeb(SPContext.Current.Web, tm.ServerRelativeUrl);


<nativehr>0x80004005</nativehr><nativestack></nativestack>Updates are currently disallowed on GET requests.  To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb. 

what is my error. Thanks

share|improve this question
up vote 2 down vote accepted

Not a good idea to use a handler for this. This code would run every time a page is called. Instead use the WebProvisioned event to set the theme when a site is created.

@toni-frankola has an example on how to do this here.

public override void WebProvisioned(SPWebEventProperties properties)
           ThmxTheme theme = ThmxTheme.Open(properties.Web.Site, ThmxTheme.GetThemeUrlForWeb(properties.Web.ParentWeb));
           theme.ApplyTo(properties.Web, false);
share|improve this answer
Thanks Anders.. This example is good for me. ASP.NET Handler module is not correct for this job. I prepared event receiver for web WebProvisioned eventhandler. it is working now. Thx. – Yasin Nov 27 '11 at 11:06

When you tries to save data to DB on GET request, SharePoint trims this operation by security reason. To solve this problem you can use AllowUnsafeUpdates property of SPWeb.

bool unsafeUpdates = SPContext.Current.Web.AllowUnsafeUpdates;
    SPContext.Current.Web.AllowUnsafeUpdates = true;
    // your code
    SPContext.Current.Web.AllowUnsafeUpdates = unsafeUpdates;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.