You should be able to do this by overriding the GetWebRequest
method of the proxy class in a partial class in a separate file. After calling the base class method, you should be able to modify the returned HttpWebRequest however you like, then return it from the method:
public partial class MyServiceProxy {
protected override WebRequest GetWebRequest(Uri uri) {
HttpWebRequest request = (HttpWebRequest) base.GetWebRequest(uri);
// do what you will with request.
return request;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…