forms authentication redirect problem.


D

Donkey

Hi i've made a loginpage and a protected one. If the user tries to
enter the protected page he gets redirected to the loginpage and at
this point everything works fine.

But when the user goes directly to the loginpage and types his pasword
it fails to login.

it tried to solve this with following code but this doesn't work
properly

if(Request.Querystring ("ReturnUrl")= "" ) then
Response.redirect("reservatie.aspx")
lblResult.Text = "juist maar niet ingelogd"
else
FormsAuthentication.RedirectFromLoginPage (TextBox1.Text, True)
end if

Anyone an idea what i have to change to get this to work.

Thanks
 
Ad

Advertisements

D

Dominick Baier [DevelopMentor]

Hi,

RedirectToLoginPage looks for the returnUrl query parameter. If none is there
you have to do the redirect on your own

a) You should check for null not "" on the query string
b) use FormsAuthentication.SetAuthCookie and do the redirect manually to
decouple what Rtlp does
 
Ad

Advertisements

D

Donkey

thanks for the quick respons.
changed it to following code and now is everything working

FormsAuthentication.SetAuthCookie(TextBox1.Text,false)
Response.Redirect("reservatie.aspx")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top