首页 > 解决方案 > 清除重复的查询字符串值 asp.net

问题描述

我想使用查询字符串中的值创建并命名一个文件夹。例如:

api/controller?lotid=value&operation=value

调试应用程序后(如下图),我意识到我测试的每个请求都变成了一个集合。结果,我怀疑该文件夹被命名(Collection)_(Collection)而不是查询字符串 values lotid_operation

知道为什么会这样吗?

这就是我在控制器文件中获取查询的方式

public string Get(string lotid, string operation) {
    //Secrets
}

在这里我创建文件夹名称

string folderName = lotid + "_" + operation;

以及 AbsoluteUri 在调试器面板中的外观

http://localhost:5000/api/otdash?lotid=XBSs&operation=xhr1&lotid=S23B&operation=xhr1&lotid=SWB45&operation=xhr1&lotid=SWB556&operation=34s&lotid=SD23&operation=xhr1&lotid=322&operation=3sl&lotid=%27sdfa%27&operation=%27ada%27&lotid=%27SWBT12 %27&operation=%27xhr1%27&lotid=%27SWEB000%27&operation=%27xhr1&lotid=%27RESS0292%27&operation=%27das%27&lotid=SBBB&operation=sasc&lotid=%27ssss%27&operation=%27A34%27

标签: c#asp.nethttpasp.net-web-api

解决方案


推荐阅读