日期:2014-05-17  浏览次数:20426 次

MVC中的问题
本帖最后由 Moriarty_Xu 于 2013-03-30 21:16:19 编辑
我在控制器Account中定义了两个action:

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

[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl) {
    ……
}


在view中调用如下:

@using (Html.BeginForm("LogOn", "Account", FormMethod.Post)) {
   ……
}


但是最后在浏览器中查看却报错了,审查元素的时候发现:


这到底是什么地方弄错了呢?
C# ASP.NET?MVC

------解决方案--------------------
引用:
本帖最后由 Moriarty_Xu 于 2013-03-30 21:16:19 编辑
            我在控制器Account中定义了两个action:
C# code?12345678public ViewResult LogOn() {    return View();} [HttpPost]public ActionResult LogOn(Lo……


贴出的代码,没有看出问题。 检查一下有没有 returnUrl 这个 input.
view 出问题概率比较高。

------解决方案--------------------
从代码看不出问题 
建议改成html的form试下 排除问题所在
还可以写成html.beginform()省略参数 默认按照当前页面url去找提交的action 默认post方式 
------解决方案--------------------
引用:
引用:有可能Aciton不能重载
如何才能让action重载呢

可以不重载 LogOn  Action  ,在这个Action 理 调用 一个方法,把原来Action理的代码 放到 调用方法里面, 重载 调用方法 。这样来解决,也可以啊