I am just learning ASP.NET MVC, and recently I discovered that the [RequireHttps] attribute automatically redirects a GET request to use SSL, for example ...
[RequireHttps]
When using IIS Express as the development server, this successfully redirects the request from http://localhost:55945/... to https://localhost/...
However, on my development system, my project uses HTTPS on port 44300 (this was automatically configured by Visual Studio 2010), and I have not yet found a way to tell MVC to use this port number for redirection, so that it goes to the required https://localhost:43300/...
I really expected this to be automatic, given that the SSL port number was set automatically by Visual Studio, and as far as I can tell, this should be done by all developers using the [RequireHttps] attribute in MVC3. In my search for a solution, I saw several problematic “solutions”, but nothing that seems completely “right” to fix it.
So, do the “right path”, what can I change (both in the source code and in my project configuration) to tell the [RequireHttps] attribute in MVC3 to use the HTTPS port that my project is configured to use?
Or, conversely, is there another other and better “right way” for setting up SSL support in an MVC3 project that does not have this problem?
Neville cook
source share