Post Data with URL

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

Post Data with URL

Postby sravan19986 » Thu Apr 14, 2016 12:05 am

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);
sravan19986
Techie
 
Posts: 11
Joined: Fri Aug 28, 2015 4:52 am

Re: Post Data with URL

Postby fddima » Thu Apr 14, 2016 9:01 am

Hello.

What you mean throwing 405 exception?

Try to start with simplier requests. Also, please use formatting tags.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Post Data with URL

Postby codelfitsleep » Sun Jan 22, 2017 1:50 am

405 is "Method Not Allowed" meaning the method you are calling isn't in the controller or wherever you are resolving the call at
codelfitsleep
Newbie
 
Posts: 6
Joined: Sat Jan 21, 2017 10:22 am

Re: Post Data with URL

Postby fddima » Sun Jan 22, 2017 5:08 am

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.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 25 guests