我想在Elmah.MVC包中要求Elmah控制器使用SSL。有没有人已经这么做了?到目前为止,我可以通过要求授权来保护它,但我希望elmah日志数据只通过SSL返回。
发布于 2013-04-24 03:39:55
打开ELMAH控制器并添加以下属性:
[RequireHttps]示例:
using System.Web.Mvc;
namespace Elmah.Mvc
{
[Authorize]
[RequireHttps]
public class ElmahController : Controller
{
public ActionResult Index(string resource)
{
/* Adapted by Alexander Beletsky */
return new ElmahResult();
}
public ActionResult Detail(string resource)
{
/* Adapted by Alexander Beletsky */
return new ElmahResult();
}
}
}ELMAH控制器的源代码取自GitHub project
https://stackoverflow.com/questions/16177561
复制相似问题