My requirement is to post data via URL through CEFGlue and i have written some piece of code and it was throwing 405 exception
Any help would be much appreciated. (Note: want to send post data in first URL hit itself)
Please go through the below code and correct me if am wrong.
- Code: Select all
string StartUrl = "http://www.google.com";
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
Byte[] bytes = Encoding.UTF8.GetBytes("Hello");
CefRequest peticion = CefRequest.Create();
CefPostData post_data = CefPostData.Create();
CefPostDataElement element = CefPostDataElement.Create();
element.SetToBytes(bytes);
post_data.Add(element);
System.Collections.Specialized.NameValueCollection headers = new NameValueCollection();
headers.Add("Content-Type", "application/x-www-form-urlencoded");
peticion.Set(StartUrl, "POST", post_data, headers);
var browser = browserCtl.WebBrowser;
//var ss = browser.CefBrowser;
browser.CefBrowser.Reload();
browser.CefBrowser.StopLoad();
//_browser.CefBrowser.GetMainFrame().LoadUrl(url);
browser.CefBrowser.GetMainFrame().LoadRequest(peticion);