Пример #1
0
        private void StartProxy(Servers.ServerRow server, string user, string fwpwd)
        {
            ProxyConfig pxc = new ProxyConfig();

            pxc.serverR  = server;
            pxc.user     = user;
            pxc.password = fwpwd;

            myProxy = new Proxy(pxc);

            myProxyThread = new System.Threading.Thread(myProxy.Start);

            myProxyThread.Start();
        }
Пример #2
0
        public Proxy(ProxyConfig _pxc)
        {
            pxc = _pxc;

            System.Diagnostics.Trace.WriteLine("Starting Lawmate gateway...");

            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };

            System.Uri u = new Uri(pxc.serverR.remoteUrl);// + "/");

            cc = new System.Net.CredentialCache();
            if (pxc.user.Contains("\\"))
            {
                cc.Add(u, "Negotiate", CredentialCache.DefaultNetworkCredentials);
            }
            else
            {
                System.Net.NetworkCredential nc = new System.Net.NetworkCredential(pxc.user, pxc.password);
                cc.Add(u, "Digest", nc);
                cc.Add(u, "Basic", nc);
            }

            System.Net.HttpWebRequest wcinit = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(u);
            jar = new CookieContainer();

            wcinit.CookieContainer = jar;
            wcinit.Credentials     = cc;
            wcinit.PreAuthenticate = true;
            wcinit.UnsafeAuthenticatedConnectionSharing = true; //for kerberos
            try
            {
                System.Net.HttpWebResponse hwinit = (System.Net.HttpWebResponse)wcinit.GetResponse();

                hwinit.Close();
                System.Diagnostics.Trace.WriteLine("Ready to start Lawmate...");
            }
            catch (Exception x)
            {
                System.Diagnostics.Trace.WriteLine(x.Message);

                return;
            }
        }