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.
C# Web API コントローラーでルート プレフィックス値を読み取ることができます。試してみましたが、これにアクセスする方法が見つかりませんでした。
[RoutePrefix("api/Account")]
変数内の値を取得する方法""。
""
RoutePrefixは通常の .NET 属性であるため、次のようにアクセスできます (コントローラー内から実行していると仮定します)。
RoutePrefix
// this.GetType() is type of current controller var prefix = this.GetType().GetCustomAttribute<RoutePrefixAttribute>().Prefix;