How to Allow Redirects in NWebsec

In one old web application I had to add a redirect form one endpoint to the address of the new application. Everything compiled without a problem, but as soon as I accessed the old address, I got this exception:

NWebsec.Core.Exceptions.RedirectValidationException: A potentially dangerous redirect was detected. Add the destination to the whitelist in configuration if the redirect was intended. Offending redirect: https://my.url.whatever

This application uses NWebsec and its redirect validation feature. If you use NWebsec as well, you need to add your redirect URLs to the list of allowed redirects. You can do that in the web.config file in the nwebsec section:

If you restart your application, your redirects will work.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.