MapWebRequestEventArgs.Proxy Property
In This Article
Gets or sets proxy information for the request.
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v24.2.dll
NuGet Package: DevExpress.Win.Map
#Declaration
#Property Value
Type | Description |
---|---|
IWeb |
The IWeb |
#Remarks
The following example shows how to use a WebProxy object to specify the request proxy settings. To pass the user Credentials with a web request, use a NetworkCredential object.
using System;
using System.Net;
using System.Windows.Forms;
using DevExpress.XtraMap;
// . . .
private void OnFormLoad(object sender, EventArgs e) {
// Create a map.
MapControl map = new MapControl();
map.Dock = DockStyle.Fill;
map.ZoomLevel = 3;
map.CenterPoint = new GeoPoint(40, -100);
this.Controls.Add(map);
ImageLayer layer = new ImageLayer();
map.Layers.Add(layer);
// Configure the map tile provider.
BingMapDataProvider provider = new BingMapDataProvider();
provider.BingKey = "Your Bing key here.";
provider.WebRequest += OnProviderWebRequest;
layer.DataProvider = provider;
}
private void OnProviderWebRequest(object sender, MapWebRequestEventArgs e) {
e.Credentials = new NetworkCredential("userName", "password");
e.Proxy = new WebProxy("http://proxyserver:80/", true);
}
Enable the UseDefaultCredentials property to use default credentials that the app.config file can contain in the defaultProxy element.
private void OnProviderWebRequest(object sender, MapWebRequestEventArgs e) {
e.UseDefaultCredentials = true;
}
You can also implement a custom proxy. To do this, you should create a class that implements the IWebProxy interface. Then assign an object of this class to the Proxy property.
See Also