Answer the question
In order to leave comments, you need to log in
c# webview. How to run a web client bypassing the proxy?
Hello. Not strong in C# programming, but I need to add functionality to programs.
There is an already written web client with source codes. It takes the proxy settings from the server from the system. I found information that you can register your proxy or disable it completely in the web client.
public static void DisableForMyRequest (Uri resource)
{
WebRequest request = WebRequest.Create (resource);
request.Proxy = null;
WebResponse response = request.GetResponse ();
}
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
namespace blablaclient {
public partial class MainWindow : LockNotificationForm {
public MainWindow() {
InitializeComponent();
PostInitialize();
}
Answer the question
In order to leave comments, you need to log in
It is necessary to add not "these lines", but "this line". Specifically, turns off the use of a proxy string request.Proxy = null; - you need to find all the places where requests are created, and add a similar line to each. I say "similar" - because the name of the variable (which is request) may differ.
By the way, requests can be created not only through WebRequest - but also through WebClient.
---
Fortunately, in fact, this task does not even require you to recompile the program again. We need to take the configuration file for the program (for the foo.exe program it will be called foo.exe.config), and do the following in it:
<configuration>
<system.net>
<defaultProxy enabled="false" />
</system.net>
</configuration>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question