79568198

Date: 2025-04-11 07:06:52
Score: 1
Natty:
Report link

The Problem This link:

<a href="/Home/FreeCoffee">

…generates a GET request to /Home/FreeCoffee, but your controller method only accepts POST:

[HttpPost]
[Route("Home/FreeCoffee")]

public async Task<IActionResult> FreeCoffee(...)

So when you click the "Coffee" link in your dropdown menu, it tries to access that URL with a GET request — and the server replies with 405 Method Not Allowed because no GET endpoint exists for /Home/FreeCoffee.

Option 1: Move the form to a separate view (recommended for better UX) If the "Coffee" dropdown item is meant to open a page with the form, then you should do this:

Create a GET action that renders a view with the phone number form:

[HttpGet]
public IActionResult FreeCoffee()

{
    return View();
}
Reasons:
  • Blacklisted phrase (1): This link
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Rahul K Suthan