Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mvc http post method gives me "The resource cannot be found. "

here is my root controller :

    [HttpPost]
    public ActionResult Index()
    {
    }

but it couldn't load project it give me :

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.

like image 689
kamiar3001 Avatar asked Jul 18 '11 07:07

kamiar3001


People also ask

How do I fix resource Cannot be found?

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.


1 Answers

Try this

public ActionResult Index()
{
}

[HttpPost, ActionName("Index")]
public ActionResult IndexPost()
{
}

The ActionName attribute enables you to create a method of one name that relates to another

like image 89
NinjaNye Avatar answered Oct 05 '22 23:10

NinjaNye