K
K
Konstantin Teploukhov2018-12-08 23:22:19
C++ / C#
Konstantin Teploukhov, 2018-12-08 23:22:19

How to check authorization post request through cookies?

xNet library
How to check authorization by post request through cookies ?
For example, if through the page code then

using (var request = new xNet.Net.HttpRequest())
                {
                    request.Cookies = new CookieDictionary();
                    request.AllowAutoRedirect = false;
                    request.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0";
                    request.AllowAutoRedirect = false;
                    request.Referer = "https://site.ru/";
                    string response = request.Post("https://site.ru/", "login=" + login + "&pass=" + password, "application/x-www-form-urlencoded").ToString();

                    if (response.Contains("Что-то в коде страницы что есть только при удачной авторизации"))
                    {
                        MessageBox.Show("Ок");
                    }
                    else
                    {
                        MessageBox.Show("Не ок");
                    }
                }

How to check for cookies?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Teploukhov, 2018-12-09
@blood-moon

Guys, it turned out to be done like this . But something tells me that this is a fierce crutch and you can’t do this. Personally, this will suit me, but I wonder how to do it right?

A
aru001, 2018-12-09
@aru001

auth_key might be out of date. Cookies themselves cannot be unambiguously checked without making a request to the site. You can try to make a request to the page, passing the stored cookies and check the return of the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question