c# - .NET 核心路由使用查询参数值
问题描述
我有带有不同值的查询参数的 URL
example.com/api/v1?op=getstudent
example.com/api/v1?op=getteacher
有没有办法下定
决心
example.com/api/v1?op=getstudent
去行动getstudent
example.com/api/v1?op=getteacher
getteacher
我尝试使用:
app.UseEndpoints(endpoints => {
endpoints.MapGet("/webhdfs/v1/{path}", async context => {
string opvalue = context.Request.Query["op"].ToString();
// return specific action
});
});
我正在使用.NET 5.0
谢谢您的帮助
解决方案
推荐阅读
- fragment-shader - 在 Godot 片段着色器中绘制矩形的问题
- python - 如何在python中编写两个相邻的函数?
- r - 计算 R tidyverse 环境中 2 个列表元素的所有组合的多个 t 检验
- javascript - PWA 应用可以发布到应用商店和游戏商店吗
- nlp - 在 nlplab Brat 注释工具中创建每个用户工作区
- java - MainActivity销毁后如何使用Service调用MainActivity方法
- influxdb - 存储在 InfluxDB 数据库中的值的移动平均值
- html - CSS - 样式化 nth-child 选择器
- rest - 如何使用 Spring MVC 构建一个简单的搜索页面?
- html - 在滚动的每个部分更改正文背景