"The return URL specified for request redirection is invalid" error when using forms authentication
In SharePoint Server 2007, when you try and login to a forms-based site the .RedirectFromLoginPage results in the following error:
"The return URL specified for request redirection is invalid"
Basically, this would happen when you navigate to a URL like https://server/_layouts/login.aspx?ReturnUrl=default.aspx%3f%3a
So, why does this happen ?
This is a problem with the URL validation on the login.aspx page. The reason why this fails is because we have the ' : ' colon character (the escape character ‘ %3a ’ in the query string. The URL query string validator does not seem to like the colon character at all.
The colon is a reserved character, per the URI RFC. You CANNOT put an unencoded ' : ' in the query or hash of a URI, period.
One workaround would be the need to %-encode the colon.
Another one would be to use a code snippet. For more information on this, please see https://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/cf27c390-07b1-4a48-b337-130a8e220069