0

그래서 나는 다음의 Web.configMVC3은 권한이없는 사용자를 어디로 리디렉션합니까?

<?xml version="1.0"?> 
<configuration> 
    .... 
    <system.web> 
    .... 
    <authentication mode="Forms"> 
     <forms loginUrl="~/Account/LogOn" defaultUrl="~" 
      slidingExpiration="true" timeout="10080" /> 
    </authentication> 

및 컨트롤러와 함께 ASP.NET MVC3 응용 프로그램이 있습니다

[Authorize(Roles="admin")] 
public class MetaStyleController : TunaController 
{ 
    .... 
    public ActionResult Index() 
    { 
     .... 

내가 로그인 아니에요, 나는 http//localhost/myAppPath/MetaStyle을 공격하려고하면, 위에서 정의한대로 페이지의 로그온으로 리디렉션됩니다. 맞습니까?

그럼 http://localhost/myAppPath/Account/Login?ReturnUrl=%2fmyAppPath%2fMetaStyle으로 리디렉션되는 이유는 무엇입니까? (통보, URL은이 로그인 오히려 로그온 이상)

Login오고있다에서? 나는 내 프로젝트에서 그것을 볼 수 없다.

+1

해당 URL에 올바른 페이지가 있습니까? – jorel

+0

스펜서, 존 갤러웨이의이 게시물이 도움이되는지 확인하십시오. http://weblogs.asp.net/jgalloway/archive/2012/05/04/asp-net-mvc-authentication-customizing-authentication-and-authorization-the- right-way.aspx –

+0

그래서 우리는 로그인 팬텀을 찾고 있습니다 :) 내 추측은 부모/자식 디렉토리의 web.config 파일을 중복하는 것입니다 ... 계정/로그인은 어딘가에 정의되어야합니다 ... – Tisho

답변

1

ASP.NET MVC 3 Release notes을 참조하십시오. 그것에 따르면 당신은 다음과 같은 애플 리케이션 설정을 사용해야합니다.

<add key="autoFormsAuthentication" value="false" /> 
관련 문제