我在View>Shared文件夹中创建了一个视图
哪个有这段代码
@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视图将在文件夹Views>帐户中创建
但是,当我点击登录按钮时,我不会重定向到logOn页面。
请帮助
发布于 2011-05-21 18:29:04
你有这个路线吗?还可以输入所需的URL,并查看是否可以访问它。当您在链接上鼠标时,它会显示正确的url吗?
发布于 2011-05-22 00:39:31
如果你悬停在链接上,它会给你什么URL?这可能是因为您正在解决ActionLink的过载错误。我以前也经历过这种事。在ActionLink调用中添加一个额外的null参数,并将其解析为正确的参数。
https://stackoverflow.com/questions/6083584
复制相似问题