ASP.NET MVC controller parameter optional (i.e Index(int? id))

后端 未结 8 1148
日久生厌
日久生厌 2020-12-19 01:53

I have the following scenario: my website displays articles (inputted by an admin. like a blog).

So to view an article, the user is referred to Home/Articles/{articl

8条回答
  •  不思量自难忘°
    2020-12-19 02:22

    I don't know if you tried this, but instead if you are typing the value directly into the URL, then, instead of passing it like this:

    controller/action/idValue

    try passing it like this:

    controller/action?id=value

提交回复
热议问题