Я пытаюсь удалить определенный параметр строки запроса из запроса OWIN, но он не работает.
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