コード例 #1
0
        static public void DeleteCredentials(string cmdrname)
        {
            CompanionCredentials c = CompanionCredentials.FromFile(cmdrname);

            if (c != null)
            {
                c.Clear();
                c.ToFile();
            }
        }
コード例 #2
0
        // Obtain a response, ensuring that we obtain the response's cookies
        private HttpWebResponse GetResponse(HttpWebRequest request)
        {
            HttpCom.WriteLog("Companion Requesting ", request.RequestUri.ToNullSafeString());
            //Trace.WriteLine("Requesting " + request.RequestUri);
            HttpWebResponse response;

            try
            {
                response = (HttpWebResponse)request.GetResponse();
            }
            catch (WebException wex)
            {
                Trace.WriteLine("Failed to obtain response, error code " + wex.Status);
                return(null);
            }
            HttpCom.WriteLog("Companion Response ", JsonConvert.SerializeObject(response));
            //Trace.WriteLine("Response is " + JsonConvert.SerializeObject(response));

            UpdateCredentials(response);
            Credentials.ToFile();

            return(response);
        }