Last post Oct 31, 2018 04:03 AM by Nan Yu
Oct 29, 2018 04:26 PM|Guhananth|LINK
I have Web Api like below
[Route("Employees", Name = "Options")]
public IHttpActionResult Options()
HttpContext.Current.Response.AppendHeader("Allow", "GET, PUT, POST, DELETE, HEAD");
Input as XMl or json i consume llike this
var request = (HttpWebRequest)WebRequest.Create(mp.EndPoint);
request.Method = mp.ActionName;
using (var response = (HttpWebResponse)request.GetResponse())
What does OPTIONS DO ?
Oct 29, 2018 04:45 PM|PatriceSc|LINK
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS (in short it allows to ask which http methods could be sent to this location)
It's a bit strange that you added code to your app and then wonder what it does (or you are are working on an already existing app ?)
HttpWebRequest is a bit outdated. I would always consider using HttpClient instead...
Oct 30, 2018 12:04 AM|Guhananth|LINK
By using HttpClient how to consume OPTIONS
Oct 30, 2018 12:11 AM|Guhananth|LINK
Write an OPTION method in Web Api and consume it in Web Api. what result will it display.
Oct 31, 2018 04:03 AM|Nan Yu|LINK
Please refer to below threads which provides code samples in your previous threads:
If above threads don't answer your question , please detailed explain the scenario and show the error message .