As we always redirect logged in user to one page, there is no need for ReturnUrl parameter be added into LoginPath during redirection to login page.
This is not critical, as we just don't use it, but this would look leaner without it.
Tried already CookieAuthenticationOptions.ReturnUrlParameter, but setting it to an empty string does not help.
app.UseCookieAuthentication(New CookieAuthenticationOptions() With {
.AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
.Provider = New CookieAuthenticationProvider() With {
.OnValidateIdentity = SecurityStampValidator.OnValidateIdentity(Of ApplicationUserManager, ApplicationUser)(
validateInterval:=TimeSpan.FromMinutes(20),
regenerateIdentity:=Function(manager, user) user.GenerateUserIdentityAsync(manager))},
.LoginPath = New PathString("/Account/Login"),
.ExpireTimeSpan = TimeSpan.FromMinutes(20),
.SlidingExpiration = True,
.ReturnUrlParameter = ""})
This is different from How to remove returnurl from url? in two ways:
- I am using Asp.Net Identity 2.2.2, not Forms Authentication
- I am looking for a way to stop adding
ReturnUrlparameter rather than removing it once is already added.