views:

61

answers:

2

Hi,

In how many ways can an HTTP request be generated?

Regards
Adeel

A: 

HttpRequest is a C# class that wraps a petition sent by a client during a Web request.

There are many ways to generate it. The most usual one happens when your browser connects to an ASP.NET website.

You can, for example, create your own custom HttpRequest to petition a specific web page from a C# console application.

Are you trying to achieve something more specific?

jdecuyper
don't forget `telnet web.server.name 80`. :)
cHao
+1  A: 

There are endless ways how you can create and from where you can send HTTP requests to a server. Actually your server has no idea, what the origin of such a request is (if it's AJAX or "regular" request, or sent from a console application or ...)

But there are HTTP methods (HTTP verbs) that (can) tell the server about the intent of the request: http://en.wikipedia.org/wiki/HTTP_Verbs#Request_methods

Also you can set headers in a request, for example the content-type or the accepted encoding: http://en.wikipedia.org/wiki/List_of_HTTP_header_fields Most JavaScript libraries for example set the (non-standard) HTTP header X-Requested-With, so your application can differentiate between regular and ajax requests.

You see, it's even possible to set your own, non-standard headers. There are endless possible combinations...

Dave