3

Is it possible to respond to HTTP POST requests in a C# console application? If so, how? I'm thinking it may involve the use of sockets (which I know very little about). Any help would be greatly appreciated!

TelJanini
  • 835
  • 9
  • 25
  • well, what are you using? asp.net? asp.net mvc? maybe this can help? http://msdn.microsoft.com/en-us/library/system.web.httpresponse.aspx – Andrei Neagu Jun 06 '12 at 17:57
  • @AndreiNeagu Unfortunately, it's not a web app, just a standard C# console application. Thanks for the assist though! – TelJanini Jun 06 '12 at 18:56

3 Answers3

7

You don't need to use sockets - .NET has had an HTTP/1.1 server since v2.0.

See: MSDN: HttpListener

Nick Butler
  • 24,045
  • 4
  • 49
  • 70
1

Have a look at the ASP.Net Web API which has been developed for this exact purpose.

ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices.

Dennis Traub
  • 50,557
  • 7
  • 93
  • 108
0

Answer on you`r question is yes, but only if you create some kind of HTTP server that would listen to HTTP requests or using open source server like:

http://www.codeproject.com/Articles/137979/Simple-HTTP-Server-in-C http://www.codeproject.com/Articles/25050/Embedded-NET-HTTP-Server http://webserver.codeplex.com/

Ivan Milosavljevic
  • 839
  • 1
  • 7
  • 19