C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
Java
Learn iOS Programming
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
1
Reply
Automatically redirect http to https in IIS.
Ritesh Singh
9y
7.5k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
IIS doesn’t have a feature to redirect HTTP to https. One way to achieve this is by modifying IIS custom error page (403.4). 1. a. Create a file called SSLRedirect.asp in your webroot with the following content:<% Data = request.servervariables(”QUERY_STRING”) URL = replace(Data, “403;”, “”) URL = replace(URL, “http://”, “https://”) response.Status = “200 OK” response.redirect URL %> Or if you want to redirect it to a single URL, you can change those lines above with this instead <% Response.Redirect(”https://www.YourDomain.com/”) %>b. Or Create a HTML SSLRedirect.html file as shown below :
New Page 1
2. Open the IIS MMC tool, select properties for your site, go to the directory security tab, click the edit button at the bottom in secure communications, and then check “Require secure channel (SSL)” option. 3. In the IIS MMC tool under your site’s properties, go to the custom errors tab, select the 403;4 error type, edit its properties to be a URL in your site and change it to /SSLRedirect.asp OR /SSLRedirect.html4. Still in the IIS MMC tool, select the properties for the custom error file you have created previously (SSLRedirect.asp), go to the file security tab, click the edit button at the bottom in secure communications, and then UN-check “Require secure channel (SSL)” option.Now the visitor will be automatically redirected to HTTPS whenever they access the HTTP.
Ritesh Singh
9y
1
How to disable disable browser's Back button in asp.net (JavaScript)?
Disable browser cache for entire ASP.NET website?
Message