I am trying to create an ActionFilter to replace some text in my HTML. Basically, when the server uses SSL, I want to replace the links to my CDN (http://cdn.example.com) with the links directly to my server (https://www.example.com). So, the structure is something like this (I assume that OnResultExecuted , where should I start):
public class CdnSslAttribute : ActionFilterAttribute
{
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
if(filterContext.HttpContext.Request.IsSecureConnection)
{
}
}
}
This will be used in my secure controllers:
[CdnSsl]
public class SecureController : Controller
{
}
The reason I want to do this is because my CDN does not support SSL. And there are links on the main pages to CDN resources. Example:
<link href="http://cdn.example.com/Content/base.css" rel="stylesheet" type="text/css" />
source
share