DeadAlive
DeadAlive

Reputation: 58

asp.net core routing parameter is always null

I have an actionresult method, which accepts a string as parameter, but whenever I query that method with url, that parameter is always null.

abc is the value of id in routing. but when I look at the stack trace I dont see method accepting any value.

http://localhost:47268/admin/AllQuarterEvent/abc

public IActionResult AllQuarterEventByMap(string map)
{
    return View(_staffMethods.GetQuarterEventsByMap(map));
}

Upvotes: 0

Views: 1192

Answers (1)

Alaaeddine HFIDHI
Alaaeddine HFIDHI

Reputation: 886

Please try this solution :

  [HttpGet("admin/AllQuarterEventByMap/{map}")]
  public IActionResult AllQuarterEventByMap([fromRoute] string map)
    {
        return View(_staffMethods.GetQuarterEventsByMap(map));
    }

Upvotes: 1

Related Questions