Quantcast
Channel: Questions in topic: "cookies"
Viewing all articles
Browse latest Browse all 91

UnityWebRequest.SendWebRequest() doesn't function properly with cookies

$
0
0
Hello I try to connect to url with UnityWebRequest.SendWebRequest() but there are some errors. Here is the code and my comments to it. UnityWebRequest login_request = UnityWebRequest.Get(serverName + "/api/integration/v1/connect?login=" + login + "&password=" + password + "&lang=en-us&timezone=%2B5"); yield return login_request.SendWebRequest(); Dictionary current_cookie = login_request.GetResponseHeaders(); foreach (var s in current_cookie) Debug.Log(s.Key + " " + s.Value); //Cache-Control no-cache //Pragma no-cache //Content-Type application/json; charset=utf-8 //Expires -1 //Server Microsoft-IIS/7.5 //Set-Cookie .ASPXAUTH=; expires=Mon, 11-Oct-1999 18:00:00 GMT; path=/; HttpOnly,SGUID=session_id=8be8af5f&Culture=en-us&langfile=ext-lang-en.js&msgfile=msg-lang-en.js&login=; path=/ //X-AspNet-Version 4.0.30319 //X-Powered-By ASP.NET //Date Wed, 26 Sep 2018 03:45:05 GMT //Content-Length 4 UnityWebRequest real_id_request = new UnityWebRequest(); real_id_request.url = serverName + "/api/integration/v1/gettree?all=true"; real_id_request.SetRequestHeader("Set-Cookie", current_cookie["Set-Cookie"]); yield return real_id_request.SendWebRequest(); Debug.Log(real_id_request.downloadHandler.text); //Here i have got error NullReferenceException, but I checked url is correct //Or if UnityWebRequest real_id_request_2 = UnityWebRequest.Get(serverName + "/api/integration/v1/gettree?all=true"); yield return real_id_request_2.SendWebRequest(); Debug.Log(real_id_request_2.downloadHandler.text); //{"children":null,"result":"NoAuth"}

Viewing all articles
Browse latest Browse all 91

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>