iT邦幫忙

0

Route中加入constraints 的問題

今天在練習MVC,想要在MapRoute中約束id的格式
於是加上了constraints
https://ithelp.ithome.com.tw/upload/images/20211021/20126929tMVmBO6NPX.jpg

我有一個PageController 底下有一個Action叫TEST
原本沒加上constraints時我可以用
https://localhost/Page/TEST?id=123https://localhost/Page/TEST/123 進入

但加了constraints後卻變成https://localhost/Page/TEST/123 才可以進入Action
如果我還是想用https://localhost/Page/TEST?id=123 又要保留constraints該怎麼做呢

感激不盡

提示:RW規則下手
感謝星空大提供方向,我再來研究看看
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答