Welcome Guest Search | Active Topics | Sign In | Register

Post Request is not working Options
John
Posted: Saturday, December 19, 2020 12:56:07 AM
Rank: Member
Groups: Member

Joined: 12/19/2020
Posts: 14
Hello,

why sending the raw request is not working?

Quote:
var request = new Request("https://demo.wpjobboard.net/wp-login.php") { Method = "POST" };

request.Headers.Add("Content-Length", "19");
request.Headers.Add("Cookie", "wpjb_transient_id=1607759726-1847; wordpress_test_cookie=WP+Cookie+check");
request.Headers.Add("Content-Type", "application/x-www-form-urlencoded");

request.PostData.AddValue("log", "7887");
request.PostData.AddValue("pwd", "789789");

tr.Send(() => { wv.LoadRequestAndWait(request); }, 60000);
John
Posted: Monday, December 21, 2020 11:53:22 PM
Rank: Member
Groups: Member

Joined: 12/19/2020
Posts: 14
The Raw Request is:

Quote:
POST /wp-login.php HTTP/1.1
Host: demo.wpjobboard.net
Content-Length: 19
Cookie: wpjb_transient_id=1607759726-1847; wordpress_test_cookie=WP+Cookie+check
Content-Type: application/x-www-form-urlencoded

log=7887&pwd=789789
eo_support
Posted: Tuesday, December 22, 2020 10:06:58 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

Your code looks fine. There is no way we can tell you why your server does not like this request though ---- that part you will have to find out from the server. The sever can reject a request for any reason it sees fit --- it could reject it because it doesn't have a cookie that it is looking for, it could reject it because the user name and password you provided is wrong. Or it could even rejected it just because it comes from the "wrong" IP address or at the "wrong" time. So you will have to find out exactly which part your server doesn't like and then correct that.

Thanks!
John
Posted: Tuesday, December 22, 2020 2:09:57 PM
Rank: Member
Groups: Member

Joined: 12/19/2020
Posts: 14
Hi,

by testing the raw request here: https://reqbin.com/
or testing it inside firefox, it seems there is no problem at all and it is working fine. but it won't work in chrome.
eo_support
Posted: Tuesday, December 22, 2020 4:24:36 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Like we mentioned in our previous reply --- we can't tell you why your server doesn't like the request. You will have to find it out from the server side. Whether to serve a request is COMPLETELY up to your server. For example, whoever setup your server could really hate Chrome and set it up to refuse to serve all other browser but Chrome. Obviously this is an extreme example but just to show you how this kind of things are completely up to the server. As such to resolve such issue, you need to start from the server. You would be wasting your time and our time by chasing this from the client end.
John
Posted: Wednesday, December 23, 2020 1:55:16 AM
Rank: Member
Groups: Member

Joined: 12/19/2020
Posts: 14
please try this one:

Quote:
POST /account/login?ReturnUrl=%2fforum%2fdefault.aspx HTTP/1.1
Host: www.essentialobjects.com
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 211

Email=john%40test.com&HasAccount=True&Password=test&RememberMe=false&submit.x=30&submit.y=7


By sending this raw request, the "Login Failed." message should be displayed, and it is on your server.
again it can not be achieved using Chromium.
eo_support
Posted: Wednesday, December 23, 2020 8:02:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
John wrote:
By sending this raw request, the "Login Failed." message should be displayed, and it is on your server.


Isn't this how it should be?
John
Posted: Wednesday, December 23, 2020 11:01:20 AM
Rank: Member
Groups: Member

Joined: 12/19/2020
Posts: 14
No, it is not. When I check the response using GetHTML(), the message (Login Failed) is not there and it only loads the URL without sending the post request.
eo_support
Posted: Wednesday, December 23, 2020 11:23:48 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Our test code must be different than yours then. Please create a small app with your test code and send the test code to us. Once we have that we will run it here and see what we can find. See here for more details on how to send the test project to us:

https://www.essentialobjects.com/forum/test_project.aspx
John
Posted: Saturday, December 26, 2020 3:09:55 AM
Rank: Member
Groups: Member

Joined: 12/19/2020
Posts: 14
I have uploaded a sample:

https://easyupload.io/4xpr15
eo_support
Posted: Wednesday, December 30, 2020 1:40:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

Please change the request Url to https from http. When our server receives an http request, it will automatically redirects to https version. This is the sequence of event:

1. You POST to http://www.essentialobjects.com/account/login with your login information;
2. Our server redirect you to https://www.essentialobjects.com/account/login with 301 permanent redirect response;
3. The WebView follow through this redirect by issuing GET https://www.essentialobjects.com/account/login without your login information

In another word, your post information is lost on step 2 due to the automatic http -> https redirect. If you issue your post directly to https, you will see the desired result.

As you can see, this redirection logic is implemented by our server and we are able to tell you why you did not get the desired result by looking into our server code. This is exactly what we have been trying to tell you in our previous reply --- you need to look into your server to find the root cause why your request does not work for you.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.