❔ The view 'GetModel1' was not found
Why is this happening?
I'm trying to call an async method (GetModel1) to access an api endpoint, which should then return the desired value to the view.
Code is as follows:
HomeController.cs:
Code for razor view:
6 Replies
Am I calling the wrongly somehow?
have you tried to reverse slash in form action? from "Home\GetModel1" to "Home/GetModel1"
another thing should be the route of your action
in HomeController you can specify it like this
[Route("home")]
public class HomeController ...
{
[...]
[HttpGet]
[Route("mysuperroute")
public async Task<IActionResult> GetModel1(int x, int y, int z) {
}
}
and change form action to "home/mysuperroute"
(maybe the last thing is better for WebAPI but I think it should work also in web pages)
(if you specify Controller route you may also have to change url that pointing home controller)
It's not working
none of them or just reverse slash?
Nvm i fixed it
Needed to redirecttoaction
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.