Introduction
HTTPS has become the standard for secure communication over the internet. In this guide, you'll learn how to enforce HTTPS in your ASP.NET application hosted in a shared environment on Windows Server 2019 with Plesk.
Prerequisites
- Windows Server 2019 with Plesk installed
- An existing ASP.NET application hosted on the server
- Access to Plesk Panel with administrator or developer privileges
Step-by-Step Guide
Step 1: Acquire an SSL Certificate
- Plesk Panel: Log in to Plesk Panel and navigate to the domain where your ASP.NET application resides.
- SSL/TLS Certificates: Go to this section to purchase or upload an SSL certificate.
Step 2: Install the SSL Certificate
- Upload Certificate: If you've acquired the certificate from an external source, upload it here.
- Let's Encrypt: Alternatively, you can also use Plesk's integrated Let's Encrypt feature to obtain a free SSL certificate.
Step 3: Configure SSL in Plesk
- Hosting Settings: Navigate to this section and select the installed SSL certificate from the dropdown.
- Permanent SEO-safe 301 redirect from HTTP to HTTPS: Enable this option to ensure all HTTP traffic is redirected to HTTPS.
Step 4: Update Application Settings
- Web.config: Open your ASP.NET application’s
web.config
file. - URL Rewrite Rules: Add rules to enforce HTTPS. Sample code snippet below:
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
Conclusion
Securing your ASP.NET application's data transmissions with HTTPS is crucial in today's digital landscape. With this guide, you should have a good starting point to secure your application using Plesk Panel on Windows Server 2019.
Additional Support
For further assistance or advanced scenarios, please refer to our knowledge base at www.domainindia.com/knowledgebase or submit a ticket at www.domainindia.com/support.