Announcement

#1 2019-09-13 16:45:53

gissow87
Member
2019-09-12
2

session.login don´t work in https

Hello/Hi/Greetings,

My problem is the following, when using the method "pwg.session.login" when doing it on a website "http: //" works correctly, but when I try to do the same logon, on a website that starts with "https : // "throws the following error
{"stat": "fail", "err": 405, "message": "This method requires HTTP POST"}

My code is as follows,
                string address = Config.WebApi.Address;

                if (address.ToLower().EndsWith("ws.php") == false)
                {
                    address = address.EndsWith("/") == false ? address + "/" : address;
                    address += "ws.php";
                }

                ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications);

                 if (address.Contains ("index.php"))
                {
                    address = address.Replace ("index.php /", "");
                }

                _httpClient = new HttpClient ();
                _httpClient.BaseAddress = new Uri (address);

                var content = new FormUrlEncodedContent (new []
                {
                    new KeyValuePair <string, string> ("username", Config.WebApi.Username),
                    new KeyValuePair <string, string> ("password", Config.WebApi.Password)
                });
// HERE THE ERROR COMES
                var response2 = _httpClient.PostAsync ("? format = json & method = pwg.session.login", content) .Result;
                string result = response2.Content.ReadAsStringAsync (). Result;
                StandardResponseInfo json = new JavaScriptSerializer (). Deserialize <StandardResponseInfo> (result);

                Console.WriteLine (result);
                if (json.stat.ToLower (). StartsWith ("ok") == false)
                    gLog.Error ("pwg.session.login:" + result);

                return json;


This happens to me in c #, I hope you can help me

Piwigo version: 2.9.5
PHP version: 7.0.30-1~dotdeb+8.1
MySQL version: 5.5.60-0+deb8u1
Piwigo URL: ***No piwigo link***

Last edited by ddtddt (2019-09-29 07:59:03)

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact