Re: How to create a subsite thru code

From: arjun (arjun.chakraborty_at_gmail.com)
Date: 11/07/04

  • Next message: Oskari: "Setting picture properties when adding multiple images into an picture library"
    Date: 7 Nov 2004 03:08:43 -0800
    
    

    Hi Daniel,
    Your solution worked.I did place my code in an if loop checking for
    isPostback=true condition on an aspx page.
    But I would ideally want this code to run in an webservice.I coded the
    webservice and deployed in _vti_bin directory(chandinh the SPdisco
    file ).However, it is giving an error called could not connect to
    Configuration database.

    I think I am missing something here...either in deployment or in
    security..
    Any Ideas,
    TIA

    "Daniel Larson (www.portalbuilder.org)" <daniel@larsontechnology.spamfree.com> wrote in message news:<BF97917D-D921-477F-8B08-15F6B910A8CA@microsoft.com>...
    > Arjun,
    >
    > This is actually a pretty common mistake. You can't do anything to update
    > the site database on a GET request, it must be in response to a POST. (Button
    > click, etc.). You can get around this by doing this in a simple web service
    > wrapper and calling the web service from the GET request.
    >
    > Daniel Larson
    > www.portalbuilder.org
    >
    >
    > "arjun" wrote:
    >
    > > Hi All,
    > > I am trying to create a subsite in a sharepoint portal using the
    > > following code
    > > Site = New SPSite("http://localhost:8019/sites/test/")
    > > Site.AllowUnsafeUpdates = True
    > > Webs = Site.AllWebs()
    > > web = Webs.Add("first12", "first", "first",
    > > Convert.ToUInt32("1033"), SPWebTemplate.WebTemplate.TeamSite, False,
    > > False)
    > >
    > > But the code is giving me the following error
    > > Updates are currently disallowed on GET requests. To allow updates on
    > > a GET, set the 'AllowUnsafeUpdates' property on SPWeb
    > > I have administrative privilages on the site.
    > >
    > > Please help!
    > >


  • Next message: Oskari: "Setting picture properties when adding multiple images into an picture library"