Hello,
I am developing a program which is connecting to SQL Server which I obtained a static/public IP for it let say it as: 141.52.88.212 on port 2458.
The program is working fine and connected to the server without any issue from everywhere in internet.
However, I installed the program inside my company PC which have intranet only. To connect to internet I have to use proxy let say it as: 215.221.60.4 on port 80 (this is not the real IP).
Now the problem is that the program is not working because of proxy setting obviously.
How can I add the proxy setting in my WPF application?
I am using the following connection string:
connectionString="Server=141.52.88.212\\SQLSERVER,2458;MultipleActiveResultSets=True;Async=true;User ID=UserTest;Encrypt=FALSE;TrustServerCertificate=FALSE;initial catalog=SQLT_TEST;Application Name=SSMA for Access;Pooling=False;PASSWORD=Pass;"
This connection is working fine on any computer not inside the company.
I tried to insert proxy setting as below:
in App.config:
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true"/>
</system.net>
In App.xaml.cs:
private void Application_Startup(object sender, StartupEventArgs e)
{
IWebProxy webProxy = new WebProxy("215.221.60.4", 80);
webProxy.Credentials = CredentialCache.DefaultCredentials;
WebRequest.DefaultWebProxy = webProxy;
}
But no luck.
Please help me.
Thanks.
UPDATE:
I discussed with IT and they said that the proxy deals with all protocols.
However, I tried to change my Port to (80) because the previous port was rejected by firewall and now the problem is that when we check using Wireshark program, my program is trying to connect to the server directly without going throw Proxy.
Is there a way to check if my sqlconnection is actually having proxy setting correctly in WPF?
Also, is there a way to change SQL protocol to HTTP rather than TCP using any other way such as HTTP-Tunneling for example?