Page redirect vb

D

Dam6

Evenin,

The code re-directs to a default.aspx page but what would I add to direct to
another page? (Thanks all)

<%
if dsLogin.RecordCount > 0 then
Session("sessUsername") = Request.Form("tfUsername")
FormsAuthentication.RedirectFromLoginPage("tfUsername.value", true )
else if ((Request.Form("tfUsername"))) <> Nothing OR
((Request.Form("tfPassword"))) <> Nothing
response.Write("Login Failed. Please Try Again.")
end if
%>
 
D

Dominick Baier [DevelopMentor]

Hello Dam6,

this redirects to whatever page the user originally requested - i guess this
code is part of your login.aspx page - if yes - look at the ?returnUrl= parameter
in the Query String - FormsAuth.RedirectFromLoginPage picks this up to do
the redirect. If you want to redirect to somewhere else, you have to set
the Auth Cookie yourself (look at SetAuthCookie) and do a manual response.redirect.

i have a sample using this technique:
http://www.leastprivilege.com/PermaLink.aspx?guid=b0e51388-71d1-4a6f-98d0-bc8cfbec4c3a
 
F

Fabrice

FormsAuthentication.SetAuthCookie(txtUsername.Text,false)

Response.Redirect("someotherpage.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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top