mercredi 26 août 2020

Can I create temporary proxy internet-connection for application debugging?

I create desktop c#-application than connects with my server. All works perfectly. But some my clients try to use my app in companies that have internet-connection for employees throught Proxy connection, and my app don't works there. I want to understand where is my mistake, but I can't debugging it because there is direct-connection on my machine and I don't have access to my client's machines. So my question: can I create proxy-connection on my machine, temporarily, for debugging my app? Any firewalls, or virtual machine than will have not direct internet connection. Thanx!

And some code:

    private static string SendRequest(SettingsStorage s, string line, string url)
    {
        WebRequest request = WebRequest.Create(url);
        request.Method = "POST";
        byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(line);
        request.ContentType = "application/x-www-form-urlencoded";
        request.ContentLength = byteArray.Length;
        if (s.Proxy != ProxyType.No)
        {
            if (s.Proxy == ProxyType.Manual)
            {
                WebProxy myProxy = new WebProxy(s.ProxyServer, s.ProxyPort);
                if (s.UseProxyPassword)
                {
                    myProxy.UseDefaultCredentials = false;
                    myProxy.Credentials = new NetworkCredential(s.ProxyUsername, s.ProxyPassword);
                }
                else
                {
                    myProxy.UseDefaultCredentials = true;
                }
                request.Proxy = myProxy;
            }
            else if (s.Proxy == ProxyType.Auto)
            {
                request.Proxy = System.Net.WebRequest.GetSystemWebProxy();
            }
        }
        //some code...
    }



Aucun commentaire:

Enregistrer un commentaire