private bool HandleUnauthenticated() { var loginClient = new RestTemplate(serviceUrl, cookieContainer); var request = new RestRequest("info", Method.GET); request.AddHeader("Accept", "*/*"); loginClient.Exchange(request); return(true); }
protected RestService(string serviceUrl, CookieContainer cookieContainer) { this.serviceUrl = serviceUrl; this.cookieContainer = cookieContainer; rest = new RestTemplate(serviceUrl, cookieContainer); rest.AddDefaultHeader("X-Requested-With", "XMLHttpRequest"); rest.AddDefaultHeader("Accept-Language", "zh-CN"); // TODO: i18n rest.UnauthenticatedHandler = HandleUnauthenticated; }