Asp.net mvc 2 ASP.NET MVC 2-身份验证表单不';不要发动行动
有一个表单可以正确地调用某个操作。但是,当我启用身份验证表单时,登录操作不会启动(我使用断点进行测试) 我的Web.config是:Asp.net mvc 2 ASP.NET MVC 2-身份验证表单不';不要发动行动,asp.net-mvc-2,Asp.net Mvc 2,有一个表单可以正确地调用某个操作。但是,当我启用身份验证表单时,登录操作不会启动(我使用断点进行测试) 我的Web.config是: <authentication mode="Forms"> <forms loginUrl="Autenticacao/Index"></forms> </authentication> <authorization> <deny users="?"/>
<authentication mode="Forms">
<forms loginUrl="Autenticacao/Index"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
谢谢您是否使用
[Authorize]
属性来装饰您的操作?我是否需要在操作“登录”中使用atribute?我只是在类的“我需要对用户进行身份验证”中使用了[Authorize],我已经从denny中删除了users=“?”,它现在可以工作了。(在未进行身份验证时,它会重新指向身份验证页面。当您启用表单身份验证且“登录操作未启动”时实际上发生了什么?它只是停留在登录表单上吗?另外,你能显示你的登录
动作控制器代码吗?嗨,柯克。这没有发生什么,我想它是重新定向到“Index”而不是“login”。我已经删除了users=“?”现在它开始工作了。
<% Html.BeginForm("Login", "Autenticacao"); %>
<input type="text" id="autenticacaoReferencia" name="autenticacaoReferencia" /><br />
<input type="text" id="autenticacaoPassword" name="autenticacaoPassword" /><br />
<input type="submit" value="Entrar" />
<% Html.EndForm(); %>
public ActionResult Login(string autenticacaoReferencia, string autenticacaoPassword, string returnUrl)
{
...
}