1
我正在開發一個使用Unity引擎的遊戲,它必須從客戶端C#發送cookie到服務器端--Java,我面臨這個問題(也許是跨平臺問題?我不確定)在java中cookieContainer中檢索數據
我寫在客戶端一堆這樣的代碼
private HttpWebRequest request(){
try{
string url = "http://localhost:8080/...";
var request = (HttpWebRequest)WebRequest.Create(url);
request.Timeout = 15000;
request.KeepAlive = true ;
request.Method= "GET";
CookieContainer cookieContainer = new CookieContainer();
Cookie Authentication = new Cookie("Session" , "09iubasd");
Authentication.Domain = url;
cookieContainer.Add(Authentication);
request.CookieContainer = cookieContainer;
request.Headers.Add("testting", "hascome");
return request;
}catch(System.Exception ex){
Debug.Log("[Exception]" + ex);
throw ex;
}
}
和服務器端是用Java編寫春季。我無法在服務器端檢索CookieContainer內的Cookie數據。任何人都可以給我任何建議或任何解決方案來解決這個問題?或者類似於Java中的CookieContainer。我已經Google搜索,但似乎沒有辦法,如果這是一個愚蠢的問題,那麼請教我。非常感謝。 Vince