0

Im a bit confused but my URLs being rendered with T4MVC on my local IIS Express contain HTTPS in the URL. On our staging server the URL being rendered contains HTTP but are using the same code like below? Does anyone know why?

<a href="#" data-bind="attr: { href: '@Url.GetSearchResultsUrl(MVC.ManageArea.DistrictAdmins.DistrictAdmin())&id=' + Id }">View</a>

public static string GetSearchResultsUrl(this UrlHelper urlHelper, ActionResult actionResult)
        {
            return urlHelper.ActionAbsolute(actionResult.AddRouteValue(Config.ViewData.SearchResults, true));
        }
public static string ActionAbsolute(this UrlHelper urlHelper, ActionResult result) {
            return string.Format("{0}{1}",urlHelper.RequestContext.HttpContext.Request.Url.GetLeftPart(UriPartial.Authority),
                urlHelper.RouteUrl(result.GetRouteValueDictionary()));

UPDATE

I just found out a F5 load balancer is doing the redirect from http to https using a 302 redirect. }

Mike Flynn
  • 22,342
  • 54
  • 182
  • 341

1 Answers1

0

There were some recent changes to automatically use https, but that should only happen if you're using the [RequireHttps] attributes. Do you know if you're using that?

See the change log for details. This was added in 2.8.0/2.8.1.

Search for 'ActionUrlHttps' in t4mvc.tt to see the relevant code.

David Ebbo
  • 42,443
  • 8
  • 103
  • 117