Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC: Can't get string parameter in my controller

Tags:

I have the following code in my controller called UserController:

public ActionResult Details(string name)
{
    MyModelDataContext db = new MyModelDataContext();
    Product user = db.Products.Single(t => t.Name == name);
    return View(user);
}

I expect that when I browse directly to http://localhost:port/User/Details/SomeName, I will reach this function with the "name" parameter containing "SomeName". I do get to this function, but "name" is null. I didn't change any of the default settings of the project.

What am I doing wrong?

Thanks