How to automatically redirect all HTTP traffic to HTTPS on Exchange

1 September 2009 ,

Users often don’t remember to use https:// when access Outlook Web Access, they simply just use https://. So to automatically redirect them to the same address but with https:// simply follow the below:

1) Logon to your exchange server

2) Open ‘My Computer’

3) Navigate to: ‘c:\Inetpub\wwwroot’

4) You should see two files, ‘default.aspx’ and ‘default.aspx.vb’ open them both in notepad and make sure they look like the below (if they don’t exist, create them and make sure they are saved under the same names):

default.aspx
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="default.aspx.vb" Inherits="login" Debug="true" %>

<html>
<head>
<title>Please wait while we redirect you</title>
</head>
<body>
<p>Please wait while we redirect you</p>
</body>
</html>
default.aspx.vb
Partial Class login
Inherits System.Web.UI.Page

Public Sub Page_Load()
If Not Page.IsPostBack Then
BindData()
End If
End Sub

Private Sub BindData()
If Request.IsSecureConnection Then
Response.Redirect("/owa")
Else
Response.Redirect("https://" & Request.ServerVariables("HTTP_HOST") & "/owa")
End If
End Sub

End Class

The important things to remember is that where in my example you see reference to /owa is for Exchange 2007 and earlier versions, if I remember correctly are /exchange or /exhweb, but to check this login to your Outlook Web Access account and take note to the later part of the address.

It’s also important that in your default.aspx file the option ‘AutoEventWireup is set to true, as above.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.