可以使用ASP.NET MVC的AllowAnonymous特性来实现,只需为需要访问的Controller或Action添加[AllowAnonymous]特性即可。示例代码如下:
[AllowAnonymous] public ActionResult Index() { return View(); }
需要注意的是,只有为需要访问的Controller或Action添加了[AllowAnonymous]特性,该页面才能在未登录的情况下访问。