1 回答

TA貢獻1848條經(jīng)驗 獲得超2個贊
要刪除查詢字符串,您可以嘗試Middleware像
app.Use(async (context,next) =>
{
if (context.Request.Query.TryGetValue("fbclid", out StringValues query))
{
var items = context.Request.Query.SelectMany(x => x.Value, (col, value) => new KeyValuePair<string, string>(col.Key, value)).ToList();
// At this point you can remove items if you want
items.RemoveAll(x => x.Key == "fbclid"); // Remove all values for key
var qb = new QueryBuilder(items);
context.Request.QueryString = qb.ToQueryString();
}
await next.Invoke();
});
- 1 回答
- 0 關(guān)注
- 182 瀏覽
添加回答
舉報