Asked by:
Error during FormsAuthentication.RedirectFromLoginPage
-
Greetings,
I created a custom security extenstion that worked great - except every call to
FormsAuthentication
.RedirectFromLoginPage would result in a"The return URL specified for request redirection is invalid." error type message.
I reverted back to windows security with no problem. Then used the Microsoft Forms Security example thinking maybee I had improperly implemented the interface.
When the forms security example provided by microsoft was configured I still get
"The return URL specified for request redirection is invalid." error type message.
Here is the actual query string when loging into the reportserver using the custom security extension:
I have replaced the ip with <machine_name>. I have been working on this problem for 2 days with no solution. Help would be nice.
Thanks,
Ross B.
Question
All replies
-
I noticed if I manually changed the ReturnURL in the address bar from
to
It almost looks like the redirect is duplicated in the query string - anyone know why this is?
-
If I change functionality from
FormsAuthentication
.RedirectFromLoginPage(TxtUser.Text, false);To:
aUrl=Request.QueryString["ReturnUrl"];
FormsAuthentication.SetAuthCookie(TxtUser.Text,false);
Response.Redirect(aURL);
This works...however I am still puzzled as to what is causing the recommended way to fail in my setup.
Ross B.
-
Hi,
I am facing a similar problem. However, I tried your solution but it did not work.
When I replace the return url from realtive to absolute link it starts working. Can you please suggest me where should i change to get this working?
Thanks in advance,
-
-
The problem with your query strinng is the it contains the colon ":" somewhere in it. That character (amongs other ones) will cause the error you got. I ran into the same problem and this is how it was solved.
Code Snippettry
{
FormsAuthentication.RedirectFromLoginPage(txtEmail.Text, false);}
catch (Exception ex){
string strURL = (null != Request.QueryString["ReturnURL"] && Request.QueryString["ReturnURL"] != "") ? Request.QueryString["ReturnURL"] : "Default.aspx"; FormsAuthentication.SetAuthCookie(txtEmail.Text, false);Response.Redirect(strURL);
}
HTH
-

