ARTICLE

Creating And Using C# Web Application Over HTTPS - SSL

Posted by Yogesh Kumar Jaiswal Articles | C# Language July 04, 2011
Here you will see how to create and use a C# Web Application over HTTPS - SSL.
Reader Level:


Whenever we use a Web Application, a common concern is security. As Messages are transferred in plain text over the network, anyone can intercept the message and read it. So a solution is to use HTTPS (SSL) instead of HTTP, so that the communication gets encrypted.

Description

You simply need to do the following:

  • Install a Certificate (Issued by Certificate Authority) on the Web Server.
  • Create a Web Application using .Net.
  • Configure the Web Application to use SSL in IIS.

1. Install Certificate

Normally in the Production environment we need to buy the certificate from well know Certification Authority (CA). In the development environment we can make use of .Net SDK's MakeCert.exe which comes with .Net 2.0 SD.
  • Path to the Exe.
    /Program Files/Microsoft Visual Studio 8/SDK/v2.0/bin/MakeCert.exe
     
  • Create and Install the certificate on the Local Machine
    Makecert -sr LocalMachine –ss My –n CN=ServiceModelSamples-HTTPS-Server –sky exchange –sk ServiceModelSamples-HTTPS-Key.


2. Create Web Application using .Net

3. Configure Web Application to use SSL in IIS
  • Type inetmgr in Run dialog box and open IIS.
  • On the Default Website Properties, Select the Directory Security tab:

    SSL1.gif
     
  • Select 'Server Certificate' from 'Secure Communication' section.
  • In the popup Wizard, select 'Assign an Existing Certificate'.
  • Click and Select HTTPS-Server certificate and finish the wizard.
  • Now right-click on your web Application Virtual directory in IIS and select Properties.

    SSL2.jpg
     
  • Select Directory Security tab.
  • Click on Edit button.

    SSL3.jpg
     
  • Check Require Secure Channel (SSL).
  • Press OK and Exit the Properties.

View Result

Test the Web Application for HTTPS.

Now in the browser, browse to your web Application, such as:

https://devpoint.dwny1.ca.kp.org/Point2/App_Web/login.aspx

The Browser will show "The page must be viewed over a secure channel".

SSL4.jpg

Login to add your contents and source code to this article
post comment
     

Good Article

Posted by Shalini Juneja Jul 05, 2011
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
Get Career Advice from Experts
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Join a Chapter