动作链接在MVC3中不起作用

时间:2011-05-21 18:21:49

标签: asp.net-mvc-3 jquery-mobile actionlink

我在视图>共享文件夹

中创建了一个视图

哪个有此代码

@if (Request.IsAuthenticated)
{
    <text>Welcome <strong>@User.Identity.Name</strong>!
    @Html.ActionLink("Log Off", "LogOff", "Account", new { data_role = "button" })</text>
}
else
{
    @Html.ActionLink("Log On", "LogOn", "Account", new { data_role = "button" })

}

比我在控制器文件夹中创建了一个控制器

 public class AccountController : Controller
    {
        //
        // GET: /Account/

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

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

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

    }

并右键单击索引logOn,并在该文件夹中创建LogOff视图 观点&GT;帐户

但是当我点击登录按钮时,我没有重定向到logOn页面。

请帮忙

2 个答案:

答案 0 :(得分:1)

你有这条路吗?同时输入预期的URL,看看是否可以访问它。将鼠标悬停在链接上时是否显示正确的URL?

答案 1 :(得分:0)

如果将鼠标悬停在链接上,它会为您提供哪些网址?可能是您正在解决ActionLink的错误重载。我之前也遇到过这种情况。在ActionLink调用中添加一个额外的null参数,它应该解析为正确的参数。

相关问题