C# Server with HTTPS

Started by
13 comments, last by paulecoyote 17 years, 7 months ago
Hi, I' currently searching for tutorial to developpe a C# server communicating with HTTPS. I'v search a lot on the web for such thing, but always found website that explain that with ASP.Net. Sadly I think that ASP.Net doens't give me the flexibility that I need. So if anyone got any nice tutorial (Client/Server side, mostly server) It would be really nice. Thank.
Advertisement
Googling for:
SSL C#

Returns a number of relevant results. HTTPS = HTTP over SSL. They don't have to be implemented in the same component.
Thank, I didn't seach with SSL. I'm not even sure what it is exacly. I'll take a look.
I am not trying to discourage you here but: What are you trying to accomplish? If you do not know what HTTPS/SSL is why are you building this? If you are looking for safe communication without installing IIS (or alike) perhaps Windows Communication Foundation might be an answer. Another option (if HTTP is not required but just safe communication) .NET 2.0 remoting might just be what the doctor ordered...
Quote:Original post by ernow
perhaps Windows Communication Foundation might be an answer. Another option (if HTTP is not required but just safe communication) .NET 2.0 remoting might just be what the doctor ordered...


I'm not going to say that these are bad options for general use, but I hate these kind of suggestions for a beginner who probably doesn't even understand the basics of encryption. All you really need for secure communications are sockets and an encryption routine. An ultra-high-level API is a dangerous crutch if you don't understand what it's doing behind the scenes.
I was going to suggest WSE because it's a high level api for security for web services, but also has tons of videos and tutorials on the MSDN explaining what things do behind the scenes and why.
Anything posted is personal opinion which does not in anyway reflect or represent my employer. Any code and opinion is expressed “as is” and used at your own risk – it does not constitute a legal relationship of any kind.
Quote:Original post by ernow
I am not trying to discourage you here but: What are you trying to accomplish? If you do not know what HTTPS/SSL is why are you building this? If you are looking for safe communication without installing IIS (or alike) perhaps Windows Communication Foundation might be an answer. Another option (if HTTP is not required but just safe communication) .NET 2.0 remoting might just be what the doctor ordered...


I have a project to make for a real compagny. The server and the client will be at different place. I have some basic experience with client/server communication but NOTHING about security. If you guys have tutorial along with what you propose, I't would be perfect. thank

Poke around here for WSE http://msdn.microsoft.com/webservices/webservices/building/wse/default.aspx
Anything posted is personal opinion which does not in anyway reflect or represent my employer. Any code and opinion is expressed “as is” and used at your own risk – it does not constitute a legal relationship of any kind.
Quote:Original post by paulecoyote
Poke around here for WSE http://msdn.microsoft.com/webservices/webservices/building/wse/default.aspx



The problem with WSE is he is going to need to run ASP.NET or another webserver to implement what he wants. It sounds like he wants to implement his server lightweight in code.

Ironically, its not very hard. The gist of it is, first you need to create your TCP server. To do this you will inheirt from System.Net.Sockets.TcpListener(). This will provide you will your TCP server without needed to use ASP or any other 3rd party software.

Once you have your server in place, you are going to want to use System.Net.Security.SslStream for all of your https traffic. This part is a bit more complicated, as you need to setup your certificates, etc...

The following example from Microsoft though should show you everything you need to know. Of course, you will have to make a client after, but that parts alot easier.

Microsoft article with sample source here

EDIT: Oops, no auto linking...
Dear Serapth,

I'm really interested about your solution. It doesn't look that hard at first look. I still have some experience in communication between a server and a client over the internet, (C++ and Java) But we didn't see the security part yet in any of my class.

Big thank to everyone. :)

Edit : Just a last question, as I can read, It's not avalable on the framework 1.1? Because I only own MS2003, and no money to buy 2005 :(
(I'll get the Express version if signup still avalable, but I won't be able to sell it heh)

This topic is closed to new replies.

Advertisement