[英]asp.net core 3.1 change route
有沒有簡單的方法來改變 asp.net core 3.1 controller 的路線?
目前我有 controller PicVideosController
URL: ...\picvideos... 我被要求將 url 修改為...\picturesvideos...
我在 controller 一側添加了一條路線:
[Route("picturesvideos")]
public class PicVideosController : Controller
得到一個錯誤AmbiguousMatchException: The request matched multiple endpoints. Matches: Main.Controllers.PicVideosController.Pay (Main) Main.Controllers.PicVideosController.Completed (Main)
AmbiguousMatchException: The request matched multiple endpoints. Matches: Main.Controllers.PicVideosController.Pay (Main) Main.Controllers.PicVideosController.Completed (Main)
似乎仍在查看原始 url
嘗試這個:
[Route("picturesvideos/[action]")]
public class PicVideosController : Controller
{
[Route("/")]
[Route("~/picturesvideos")]
[Route("~/picturesvideos/index")]
public IActionResult Index()
....
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.