1

In HttpWebRequest a user can pass Method as Post OR Get OR Put OR DELETE etc.

But for our specific project I need to pass HttpMethod as "POST /api/login HTTP/1.0".

But this is not allowed in .NET CF.

Then can any one tell me workaround for this please for customizing Http Method.

Thanks in advance.

2
  • "But this is not allowed in .NET CF." What do you mean? What code do you use to do that? What errors do you get? Commented Apr 20, 2012 at 14:12
  • Hi CodeCaster, I am trying following code : HttpWebRequest hbWebRequest = (HttpWebRequest)System.Net.HttpWebRequest.Create(WebService+"/api/login"); hbWebRequest.Method = "POST /api/login HTTP/1.0"; Commented Apr 23, 2012 at 5:17

2 Answers 2

5

The reason that this isn't allowed in .NET CF is because it's nonsensical: there isn't a HttpMethod matching what you listed.

I think you are mistaken. Your method is POST, your target url is /api/login and the protocol is HTTP/1.0. So, you should be making a HttpWebRequest to that Url.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi Dan, Thanks for your reply. But this is possible in Objective C. So, is there any way around for this.
It may be possible in objective C, but that doesn't mean it's valid. A HttpMethod with that value isn't allowed by the Http spec.
1

Like the manual states:

The Method property can be set to any of the HTTP 1.1 protocol verbs: GET, HEAD, POST, PUT, DELETE, TRACE, or OPTIONS.

So simply use hbWebRequest.Method = "POST";.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.