Google Answers Logo
View Question
 
Q: Creating a https server in C# with the System.Net.HttpListener class ( No Answer,   2 Comments )
Question  
Subject: Creating a https server in C# with the System.Net.HttpListener class
Category: Computers > Programming
Asked by: busyguy-ga
List Price: $20.00
Posted: 04 Jun 2006 16:27 PDT
Expires: 04 Jul 2006 16:27 PDT
Question ID: 735306
Hi

Recently i made a simple web server using C#'s HttpListener class.
In the help file it says that the class is capable of processing https
requests and that a program called httpcfg.exe is used to setup the
certificate.
I have a valid certificate and this httpcfg program but after
following the help files instructions to the letter i still come up
with the same problem.
When i try to access the page from my web browser the connection is
canceled and no page loads (It worked fine with the standard http
pages).
I've installed the certificate and used the thumbprint and my programs
GUID as arguments to the httpcfg program without success.

Can you tell me in understandable terms how to setup https with HttpListener.

Thanks

Clarification of Question by busyguy-ga on 15 Jun 2006 05:11 PDT
All i need is a simple way to accept and reply to http and https
requests in C# without complication.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Creating a https server in C# with the System.Net.HttpListener class
From: aldojj-ga on 16 Jun 2006 05:47 PDT
 
i play with this sometimes ago and find that the following steps work:
1) use the sample at http://msdn2.microsoft.com/en-us/library/34xswsd2.aspx
2) from a command shell run:
 makecert -r -pe -n "CN=localhost" -b 01/01/2000 -e 01/01/2036 -eku
1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft
RSA SChannel Cryptographic Provider" -sy 12
this will create and install a certificiate named local in the machine storage
3) open certifcate mmc and copy the certifcate  local you find in
personal certificates into trusted root certificate auth.
4)  from a command shell run:

httpcfg.exe set ssl -i 0.0.0.0:8585 -c "MY" -h XXXXX

where 0.0.0.0:8585 is ip and port, this is for http://localhost:8585
while XXXX is the Thumbprint value of the local certificate. Click on
the cert and then tab details. Remeber to delete the blanks between
numbers.

5) run the sampel so that it lisnet on https://localhost:8585/something

HTH,
Al
Subject: Re: Creating a https server in C# with the System.Net.HttpListener class
From: kaef-ga on 21 Jun 2006 03:44 PDT
 
MiniHttpd: an HTTP web server library
http://www.codeproject.com/cs/internet/minihttpd.asp

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy