locked
Why MVC doesn't work in https? RRS feed

  • Question

  • User-1863938436 posted

    Hi all,

    I got a web site from a vendor, which is developed by MVC2 and some other libraris. I created a http site on Windows 2003 + IIS 6, and the code works fine. When I assecc http://localhost/home, the default view returns.

    Now, I created a new site using https, but map to the same directory of the http site, also requires a RSA token authentication. But after authenticated, if I try https://localhost/home, a 404 error appears. It seems the http handlers doesn't work for https.

    Is there anybody know why this happened? Or any special configuration should be make in web.config?

    Monday, November 7, 2011 9:40 PM

Answers

All replies

  • User-836030956 posted

    Hi,

     

    Mvc Application can work with Https I have done it in my current project. There are no any extra efforts required for that. As you mention in your question please deploy your website with deferent port that may be work for you like you have deploy your website http://localhost/home

    Now for https you can use  port 8080 like   https://localhost:8080/home    

    Regards,

    Bhavik

    Monday, November 7, 2011 11:46 PM
  • User197322208 posted

    Now, I created a new site using https, but map to the same directory of the http site, also requires a RSA token authentication. But after authenticated, if I try https://localhost/home, a 404 error appears

    Did you have configured the same ? ( add .* extension to the ASp.NET dll handler) ?

    Tuesday, November 8, 2011 2:07 AM
  • User-1863938436 posted

    Now, I created a new site using https, but map to the same directory of the http site, also requires a RSA token authentication. But after authenticated, if I try https://localhost/home, a 404 error appears

    Did you have configured the same ? ( add .* extension to the ASp.NET dll handler) ?

    Actually I just use the same web.config. Now I guess inside the code when developer registering the route, they hard code on 80 port.

    Tuesday, November 8, 2011 2:37 AM
  • User-836030956 posted

    Yes ,

    404 error is come because point to same url just with https so you just use deffrent port then check i think work

    https://localhost:8080/home,

    Regards,

    Bhavik

    Tuesday, November 8, 2011 3:00 AM
  • User-1280676833 posted

    Hi

    There are many ways to achieve it. One way is

                routes.Add(new Route("Account/LogOn", new MvcRouteHandler())
                {
                    Defaults = new RouteValueDictionary(new { controller = "Account", action = "LogOn" }),
                    DataTokens = new RouteValueDictionary(new { scheme = "https" })
                });

    For more details, you can refer to:http://blog.stevensanderson.com/2008/08/05/adding-httpsssl-support-to-aspnet-mvc-routing/

    Edit: you can check this thread:http://forums.asp.net/p/1526452/3684203.aspx

    Hope this helpful

    Regards

    Young Yang

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 9, 2011 9:17 PM