1

Is it possible to make an exact identical POST with HttpWebRequest in C# as a browser would? Without a page being able to detect that it is actually no browser?

If so, were could i read up more on that?

5
  • UserAgent - stackoverflow.com/questions/3057328/… Commented May 10, 2012 at 20:03
  • @seth flowers is correct use Fiddler. You can capture posts and replay them. If nothing else it will give you the information need to duplicate the post. Commented May 10, 2012 at 20:09
  • No site would be able to detect that? Its always possible with Fiddler and HttpWebRequest? Commented May 10, 2012 at 20:11
  • Just trying to understand difference between a browser and HttpWebRequest :) Commented May 10, 2012 at 20:11
  • Fiddler will allow you to actually see the actual web-request. You can set some property in HttpWebRequest and see it in action inside fiddler. Commented May 10, 2012 at 20:14

2 Answers 2

2

Download and become familiar with a tool like Fiddler. It allows you to inspect web requests made from applications, like a normal browser, and see exactly what is being sent. You can then emulate the data being sent with a request created in C#, providing values for headers, cookies, etc.

Sign up to request clarification or add additional context in comments.

Comments

1

I think this is doable.

Browser detection is done based on a header in the request. All you need to do is set that header. In HttpWebRequest we dont need to set the headers collection but rather the .UserAgent property.

Eg:

.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"; 

There is quite a lot to user agents. Check this link for the complete list of User-Agents

Useful Links:

How to create a simple proxy in C#?
Is WebRequest The Right C# Tool For Interacting With Websites?
http://codehelp.smartdev.eu/2009/05/08/improve-webclient-by-adding-useragent-and-cookies-to-your-requests/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.