From 0e4781ea7470310663b941f53919aeeaf9b824ff Mon Sep 17 00:00:00 2001 From: Matt Kocaj Date: Tue, 6 Oct 2015 16:31:54 +0800 Subject: [PATCH] added comprehensive usage for folks who don't even have SSL enabled --- readme.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index e3b6e8f..a7bf3af 100644 --- a/readme.md +++ b/readme.md @@ -10,6 +10,14 @@ PS> Install-Package Owin.ForceHttps # Usage +1. ### Make sure your project has SSL enabled + + * Find your web project and hit `F4` to get the Properties window + * Toggle `SSL Enabled` to `True` and note the port number for the `SSL URL` + ![VS project Properties window snip](http://i.imgur.com/kn8ENIa.png) + +2. ### Add `app.UseForcedHttps()` to `Startup.cs` class: + ```csharp using Owin; using Microsoft.Owin; @@ -17,7 +25,11 @@ using Microsoft.Owin; namespace MyApplication { public class Startup { public void Configuration(IAppBuilder app) { +#if DEBUG + app.UseForcedHttps(44309); // IIS Express +#else app.UseForcedHttps(443); +#endif //configure other middleware } @@ -25,8 +37,6 @@ namespace MyApplication { } ``` -There is also an overload which allows you to specify a different port for HTTPS. Useful for local development. - # License MIT