How do I write an HTTP(S) listener in .NET

  • Thread starter Thread starter EMonaco
  • Start date Start date
E

EMonaco

All,

I am looking to create an HTTP listener class in .NET. I don't expect the
user to have IIS also I don't want to use WinHTTP. It should support SSL
connections, including client/server certs. Is there a .NET class or set of
classes that I can use?

I've looked briefly, at System.Web.Hosting and think this MAY be useable
unfortunately the documentation is very skimpy. I figure maybe a better
alternative would be TCPListener provided I can support SSL connections
using client & server certs. But not sure if this functionality is supported
in the FCL.

Anybody done something like this without IIS and WinHTTP? I'd appreciate
your thoughts/ideas.


Regards,
Erin.
 
Hello Erin,

Thanks for your post. As I understanding, you want to create a HTTP server
of your own in .NET. Please correct me if there is any misunderstanding.

Based on my experience and research, you need to create your HTTP server at
the socket level where you should send/receive TCP/IP packets,
parse/process HTTP(S) requests. In .NET, System.Net.Sockets namespaces
provides socket related classes, say, TCPListener for socket server.
Generally speaking, HTTP server listens at port 80, while https: at 443.
There is a sample C# HTTP server at:
http://www.123aspx.com/resprint.aspx?res=75.

For a complete implementation of your HTTP(S) server, please refer to the
following specifications:

Hypertext Transfer Protocol
http://www.w3.org/Protocols/rfc2616/rfc2616.html

The SSL Protocol
http://wp.netscape.com/eng/ssl3/ssl-toc.html

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
EMonaco said:
All,

I am looking to create an HTTP listener class in .NET. I don't
expect the user to have IIS also I don't want to use WinHTTP. It
should support SSL connections, including client/server certs. Is
there a .NET class or set of classes that I can use?

I've looked briefly, at System.Web.Hosting and think this MAY be
useable unfortunately the documentation is very skimpy. I figure
maybe a better alternative would be TCPListener provided I can
support SSL connections using client & server certs. But not sure if
this functionality is supported in the FCL.

Anybody done something like this without IIS and WinHTTP? I'd
appreciate your thoughts/ideas.

Check out the mother of all OS .NET web servers ;-)

http://www.asp.net/Projects/Cassini/Download/Default.aspx?tabindex=0&tabid=1

Cheers,
 
I would look at the Cassini sample on www.asp.net and use the portions of it
you can, as it is already written as a lightweight web server.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
Back
Top