0

I've web application which sends HTTP request to server.It uses WebRequest.Create method. My question is.I need to change domain name or ip for HTTP request but i can't see the right place.Look at it please.

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; 

Here's place of domain or am I wrong?

this.WebRequest = (HttpWebRequest) WebRequest.Create(Address); 

This constant(address),where is it in code?I am using SAE for .NET

1 Answer 1

1

This constant(address),where is it in code?

It's the first parameter for your method:

public string httpGet(string Address, [Optional, DefaultParameterValue(true)] bool Redirect) 

Admittedly it looks like a property access, but that's just because your parameters (and method name) don't follow .NET naming conventions.

So you need to find wherever you're calling the method, and change the first argument there.

I'd also suggest that instead of using attributes to specify optional parameters, you use the C# syntax, assuming you're using C# 4 or above:

// No need for "http" here - that's pretty implicit in your type name public string DownloadText(string address, bool redirect = true) 
Sign up to request clarification or add additional context in comments.

6 Comments

Jon.I just saw an example from MSDN about WebRequest myRequest = WebRequest.Create("your domain"); How can i find that WebRequest.Create(Address)?It sockets for gwc server.Here's pick fastpic.ru/view/46/2013/0716/… I'd like to change this IP in Reflector but can't find right place for "string Address"
@user2277228: I have no idea what you mean. You're calling WebRequest.Create(string) and passing in the address that's being passed to your method. WebRequest.Create takes a URL, not just a domain. I'm also flagging your comment as the picture you've linked to is NSFW.
Jon.The method takes a URL.But what is that URL? imageshack.us/photo/my-images/690/vs8e.jpg
How does it know that it sends requests to "google server".Where is that place?
I'm just testing with sniffer.46.174.48.38(my ip) 173.194.32.132(server) HTTP 382 GET /watch?gl=US&hl=en&client=mv-google&v=C1Xu4gGwa4k HTTP/1.1 Where is set ip 173.194.32.132 at the code?I need to change it place.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.