문제

I have some troubles with configuring requesting for client certificate to protect mvc area. I can easily configure this for whole application, but is it possible to do this only for one area (admin for example) ?

도움이 되었습니까?

해결책

So, the easiest way to achieve this, is to create a folder named as your area and set required SSL settings on this folder using IIS Manager. Then you can delete this folder. IIS Manager will set required settings in applicationHost.config file. Or you can manually edit applicationHost.config.

Here is the applicationHost.config manual.

다른 팁

You can add SSL requirements to specific controllers by adding [RequireHttps] at the top of the controller like so:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Net.Http;
using System.Dynamic;

namespace com.yourdomain.Controllers
{
    [RequireHttps]
    public class SomeController: Controller
    {
       //some logic here
    }

}

In your case this would be something like your admin controller

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top