- Home /
How to set a Cookie with UnityWebRequest?
I have difficulties using UnityWebRequest with Cookies. My webserver uses authentication and returns a Response Header "Set-Cookie" with a key-value pair. Unfortunately making more requests after the first authentication request, the Cookie is not stored by UnityWebRequest and therefore the requests are not permitted. Sadly it is also forbidden to set a request Header myself with the Name "Cookie".
Am I doing something wrong here? Or is this currently a known Limitation?
Thanks in advance!
The issue is solved in Unity 5.4. This version removes the tag Experimental to the namespace Networking.
Thanks for the info! As 5.4 is co$$anonymous$$g soon I'll wait for the fix :)
Answer by Jordi-Bonastre · Feb 22, 2016 at 03:00 PM
You should use a call like this: SetRequestHeader("Cookie", string.Format("session={0}", token));
I haven't tested this line, but if it doesn't work you should report a bug and send me the bug number using the support portal.
There is a forum thread were you could give more information with multiple links and suggestions for workarounds: http://forum.unity3d.com/threads/unitywebrequest-cookies.383530/
Your answer
Follow this Question
Related Questions
Imitate cURL request using UnityWebRequest 0 Answers
I want my games to communicate with my site. Do I need Uniweb? 0 Answers
Unity 2017.3 Experimental 4.6 .NET not including System.Web.Http assembly for HttpClient use 0 Answers
Backend solution for asynchronous game 1 Answer
Using NetworkSceneManager with NetCode,Using Network Scene Loader with NetCode? 1 Answer