我有一个向服务器发送 HTTP 请求的 Web 应用程序。它使用 WebRequest.Create 方法。我的问题是。我需要为 HTTP 请求更改域名或 ip,但我看不到正确的位置。请看一下。
public WebWrapper()
{
this.UseProxy = false;
this.UA = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1";
this.Proxy = new WebProxy();
this.LastPage = "http://google.com/";
this.cookies = new CookieContainer();
}
public string httpGet(string Address, [Optional, DefaultParameterValue(true)] bool Redirect)
{
string str;
try
{
IEnumerator enumerator;
this.WebRequest = (HttpWebRequest) WebRequest.Create(Address);
this.WebRequest.Method = "GET";
this.WebRequest.Headers.Set("Accept-Language", "en,en-us");
this.WebRequest.Headers.Add("Cache-Control", "no-cache");
this.WebRequest.CookieContainer = this.cookies;
this.WebRequest.UserAgent = this.UA;
this.WebRequest.Referer = this.LastPage;
这是域的地方还是我错了?
this.WebRequest = (HttpWebRequest) WebRequest.Create(Address);
这个常量(地址),它在代码中的哪里?我正在使用 SAE for .NET