English 中文(简体)
申请用的是MVC3的行动结果方法
原标题:Application doesn t read action result method in MVC3

We are using MVC3 and we are trying to create a method in a Controller named UserSesionManager. This method is called from

@using (Html.BeginForm("GetStatTypesDistribution", "UserSesionManager", FormMethod.Post, new { enctype = "multipart/form-data" }))

In the UserSesionmanager Controller we have:

[HttpPost]
        public ActionResult GetStatTypesDistribution(FormCollection form)

However when we call it we get this error:

Server Error in  /  Application.

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /UserSesionManager/GetStatTypesDistribution

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

此外,我补充说,一个断点说,源码是原版本的不同形式。 我遵循右边点击的指示,但错误仍然存在。

为什么发生这种情况,以及我们如何能够解决这个问题?

感谢很多!

问题回答

确保控制器的名称为,而不仅仅是UserSesionManager:

public class UserSesionManagerController: Controller
{
    ...

    [HttpPost]
    public ActionResult GetStatTypesDistribution(FormCollection form)
    {
        ...
    }
}

还确保你在全球有违约路线。 页: 1

routes.MapRoute(
    "Default",
    "{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

Rebuild your solution. Stop the web server you are using for debugging and check to ensure if you are using the built in web server (Cassini) it s not running in the system tray.

图5 如果你仍然从小菜单上把模块的窗子上填上错误,那么模块就能够使用。 在座标上列出贵方的代码。

If it s still an issue delete the apps folder from the temporary asp.net files folder and try debugging again but the modules window should give some info.





相关问题
How to set response filename without forcing "save as" dialog

I am returning a stream in some response setting the appropriate content-type header. The behavior I m looking for is this: If the browser is able to render content of the given content type then it ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Does HttpWebRequest send 200 OK automatically?

Background: I am implementing Paypal IPN handler. This great article on Paypal states that I am required to send a 200 OK back to Paypal after I read the response. The processing of IPN request is ...

Java HTTPAUTH

我试图把桌面应用程序连接起来,我是同D.icio.us api @ Delicious Alan书写的,简单地向他们提供我的用户名和密码,并请他把书记上写给我......。

Finding out where curl was redirected

I m using curl to make php send an http request to some website somewhere and have set CURLOPT_FOLLOWLOCATION to 1 so that it follows redirects. How then, can I find out where it was eventually ...

热门标签