Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:38:39+00:00 2026-05-30T09:38:39+00:00

The question: Are there any means (perhaps a workaround) to support the PUT and

  • 0

The question:

Are there any means (perhaps a workaround) to support the PUT and DELETE HTTP verbs with a WCF 4.0 REST service secured using OAuth 2.0 and DotNetOpenAuth 4? I’m not using the WCF Web API or WCF Starter Kit.

What I have done so far:

Consider the following WCF 4.0 REST Service:

[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class MyService
{
    [WebGet(UriTemplate = "")]
    public List<Resource> GetCollection()
    {
        /* some implementation */
    }

    [WebInvoke(UriTemplate = "", Method = "POST")]
    public Resource Create(Resource instance)
    {
        /* some implementation */
    }

    [WebGet(UriTemplate = "{id}")]
    public Resource Get(string id)
    {
        /* some implementation */
    }

    [WebInvoke(UriTemplate = "{id}", Method = "PUT")]
    public Resource Update(string id, Resource instance)
    {
        /* some implementation */
    }

    [WebInvoke(UriTemplate = "{id}", Method = "DELETE")]
    public void Delete(string id)
    {
        /* some implementation */
    }
}

OAuth 2.0 is used for controlling access to the service. It is achieved with a custom ServiceAuthorizationManager implementation using DotNetOpenAuth to do all the work. The implementation is almost identical to that provided by the DotNetOpenAuth 4.0 samples.

For POST and GET requests it works great. However, the requests fail for the PUT and DELETE requests with the error message:

'AccessProtectedResourceRequest' messages cannot be received with HTTP verb 'PutRequest'

The client code looks as similar to:

public class ResourceClient
{
    public Resource UpdateResource(Resource resource)
    {
        var uri = new Uri(new Uri("http://api.example.com/"), Resource.Format("resources/{0}", resource.Id));
        var serializer = new DataContractSerializer(typeof(Resource));
        var request = (HttpWebRequest)WebRequest.Create(uri);
        request.Method = "PUT";
        request.ContentType = "application/xml";
        ClientBase.AuthorizeRequest(request, Authorization.AccessToken);

        using (var requestStream = request.GetRequestStream())
        {
            serializer.WriteObject(requestStream, resource);
        }

        using (var response = (HttpWebResponse)request.GetResponse())
        {
            using (var responseStream = response.GetResponseStream())
            {
                Debug.Assert(responseStream != null, "responseStream != null");
                return (Resource)serializer.ReadObject(responseStream);
            }
        }
    }
}

From the answer of another question it seems that this is may be a deficiency in DotNetOpenAuth. Looking at the OAuth 2.0 spec, I don’t see anything prohibiting the use of the PUT or DELETE http verbs when accessing resources. That said, I’m not an expert in OAuth 2.0, nor do I know it by heart.

So I thought I would be “clever” and use the “X-HTTP-Method-Override” to specify PUT and then POST the request to the resource server. I implemented the behaviour as explained in this sample. Interestingly enough the custom behavior was called before my ServiceAuthorizationManager implementation, resulting in the exact same error.

An alternative would be to address the issue within DotNetOpenAuth itself, but I have no idea where to start.

I’m running out of ideas and I’d appreciate any suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:38:40+00:00Added an answer on May 30, 2026 at 9:38 am

    This is tracked by Issue #62. You can glance at the fix for it if you want to port it to your version without waiting for the next release.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen this question: Are there any decent UI components for touch screen
This is a simple question : Is there any automatic indentation alignment on Eclipse
Simple question here: is there any way to convert from a jagged array to
Just a curious question but is there any programs that can help/aid you when
(See question below for more context): Are there any situations in which <machineKey validationKey=AutoGenerate,IsolateApps
My question is very simple: Is there any solution to install xCode, or equivalent,
My question is very simple: is there any way to (programmatically, technically, or manually)
Update: This question is a duplicate of Are there any programming languages targeting PHP,
Simple question. Are there any tools for generating Xcode projects from the command line?
Simple question really, is there any programmatic way to over load the choose a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.