Page 1 of 1

Post Data with URL

PostPosted: Thu Apr 14, 2016 12:05 am
by sravan19986
Hi,

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);

Re: Post Data with URL

PostPosted: Thu Apr 14, 2016 9:01 am
by fddima
Hello.

What you mean throwing 405 exception?

Try to start with simplier requests. Also, please use formatting tags.

Re: Post Data with URL

PostPosted: Sun Jan 22, 2017 1:50 am
by codelfitsleep
405 is "Method Not Allowed" meaning the method you are calling isn't in the controller or wherever you are resolving the call at

Re: Post Data with URL

PostPosted: Sun Jan 22, 2017 5:08 am
by fddima
codelfitsleep wrote:405 is "Method Not Allowed" meaning the method you are calling isn't in the controller or wherever you are resolving the call at

There is can be other hidden restrictions. But question kind of obsolete.