Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はいくつかのページを見ていますが、デフォルトではコントローラー/アクション/ID のルーティングの ID が文字列ではなく整数であることに気付きました。
文字列になるように変更するにはどうすればよいですか?
純粋に次のようなアクションを作成することによって:
Public Function MyAction(ByVal id as String) as ActionResult
フレームワークがURLMyController/MyAction/SomeIdを変換します。通常、最後のセクションは整数に変換されます。これがメソッドの定義方法であり、文字列であると言うのを妨げるものは何もないため、変換は必要ありません。
MyController/MyAction/SomeId