how to authorize a specific page to be accessed anonymously in asp.net MVC using the web.config?

114 Views Asked by At

How to authorize a specific page to be accessed anonymously in asp.net MVC using the web.config?

I know that this could be done using the [Authorize] and [AllowAnonymous] attributes but I was wondering if I can do that directly from the config file.

For example

[Authorize]
public class HomeController : Controller
{
    [AllowAnonymous]
    public ActionResult Index()
    {
        return View();
    }


    public ActionResult TrackingPage()
    {
        return View();
    }


    public ActionResult profile()
    {
        ViewBag.profile = true;
        return View();
    }
    public ActionResult content()
    {
        return View();
    }

} 

If I want to do the same thing from the config file, how that could be done?

0

There are 0 best solutions below