我正在尝试从OWIN请求中删除某些querystring参数,但是它不起作用。
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseOwinCookieSaver();
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
// removed for brevity
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
// removed for brevity
Notifications = new OpenIdConnectAuthenticationNotifications
{
RedirectToIdentityProvider = (context) =>
{
if (context.ProtocolMessage.RequestType == OpenIdConnectRequestType.AuthenticationRequest)
{
//here i am trying to remove querystring `q=abcd`
request.QueryString = new QueryString(WebUtility.UrlEncode(WebUtility.UrlDecode(request.QueryString.ToString()).Replace("q=abcd", "")));
}
return Task.FromResult(0);
}
}
});
}
}
在验证后,当请求返回时,URL仍然显示查询字符串q=abcd