Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Updates are currently disallowed on GET requests

  Asked By: Jasmine    Date: Jul 10    Category: Sharepoint    Views: 3473

I am developing a web application which will add a new link to a link
web part on the home area. Everything runs fine until the
newLink.Update() call. The error that is thrown is

Updates are currently disallowed on GET requests. To allow updates on a
GET, set the 'AllowUnsafeUpdates' property on SPWeb.

I registered the webcontrols namespace as directed in the sdk

<%@ Register Tagprefix="SharePoint"
Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>

I added the form digest control as directed

<form id="Form1" method="post" runat="server">

<SharePoint:FormDigest runat="server"/>

</form



I added the following code to the code behind also as was directed in
the sdk if you are using the administration namespace

Context.Items(Administration.SPGlobalAdmin.RequestFromAdminPort) = True

Page.RegisterHiddenField("__REQUESTDIGEST",
objGlobalAdmin.AdminFormDigest

Still I am getting the same error. Here is my code which I am using
homeArea = AreaManager.GetArea(portalContext, homeGuid)

homeArea.Web.AllowUnsafeUpdates = True

'get the link web part information and add an item

Dim linkLists As SPList

Dim linkListItems As SPListItemCollection

Dim newLink As SPListItem

linkLists = homeArea.Web.Lists("Test_Links")

linkListItems = linkLists.Items

newLink = linkListItems.Add

newLink("URL") = "http://google.com" + ", search the web"

newLink("Category") = "HR Links"

newLink.Update()

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Aastha Acharya     Answered On: Jul 10

To troubleshoot further I would firstly manually allow unsafe updates  to
see if your code  then runs (firstly removing your line that tries to set
this in your code). You can do this from the virtual server general
settings in SahrePoint Central Admin (Web Page Security Validation)

If this works then it could be that your code that is trying to set
AllowUnsafeUpdates is not authorized to do so. If you are dealing with
the requestdigest issue correctly then you should not need to be trying
to set  AllowUnsafeUpdates in your code.

 
Answer #2    Answered By: Glenda Roth     Answered On: Jul 10

I turned of the security validation for the Virtual Server in
"Sharepoint Central Administration" and tried to run the code  again. The
web app is running under the machine's administrator ID and I have added
this machine admin as the Sharepoint administration  Group in the
"SharePoint Central Administration." The location of my web  application
is http://server-name:port/_layouts/

Please note that I am using the object model to achieve my objective and
have been unsuccessful so far. I added  the web application  dll to the
GAC as well thinking that maybe the dll needs to have full trust. Still
the request throws the same error.

Everything works fine  till the newlink.update() method is called. The
surprising thing is that the same code runs as a charm when made as a
console application.

 
Didn't find what you were looking for? Find more on Updates are currently disallowed on GET requests Or get search suggestion and latest updates.




Tagged: