Facing the problem on "RedirectFromLoginPage"

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2005
Posts: 1
Reputation: johnangxun is an unknown quantity at this point 
Solved Threads: 0
johnangxun johnangxun is offline Offline
Newbie Poster

Facing the problem on "RedirectFromLoginPage"

 
0
  #1
Feb 20th, 2005
Hi All,

I now creating the login page. So I have using the
  1. ForumsAuthentication.RedirectFromLoginPage(UserName.Text,False)

So by default it will redirect to the default.aspx
So this part is ok. Can I redirect to the another file name?

Another problem is, I will do the checking wheter the user is login. If user are not log in it will redirect to login.aspx I wrote code like:
  1. If Session("Logged_IN").Equals("No") Then
  2. Response.Redirect("login.aspx")
  3. End If

But after I do the login and success, it will pop to the default.aspx. Can I redirect to the webpage where i original requested. I search from the web that ForumsAuthentication.RedirectFromLoginPage can redirect to caller webpage, but how? I feel blur!

Thanks
Best Regards
John Ang
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 26
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Facing the problem on "RedirectFromLoginPage"

 
0
  #2
Apr 7th, 2005
Question 1: Can I redirect to the another file name?

Yes,
by changing the default page settings in/under IIS

Question 2: But after I do the login and success, it will pop to the default.aspx. Can I redirect to the webpage where i original requested.

I am not sure what you are asking here? What page you originally requested?

Do you mean one that was entered into the address bar, but forced you to the Login page?? Yup, sure can once you have logged in the session is started, keep the browser open and on the default.aspx page and enter or select the address in the browser address bar that you were trying to get to...and voila!

Hope this helps?

Originally Posted by johnangxun
Hi All,

I now creating the login page. So I have using the
  1. ForumsAuthentication.RedirectFromLoginPage(UserName.Text,False)

So by default it will redirect to the default.aspx
So this part is ok. Can I redirect to the another file name?

Another problem is, I will do the checking wheter the user is login. If user are not log in it will redirect to login.aspx I wrote code like:
  1. If Session("Logged_IN").Equals("No") Then
  2. Response.Redirect("login.aspx")
  3. End If

But after I do the login and success, it will pop to the default.aspx. Can I redirect to the webpage where i original requested. I search from the web that ForumsAuthentication.RedirectFromLoginPage can redirect to caller webpage, but how? I feel blur!

Thanks
Best Regards
John Ang
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1
Reputation: TraxionDesign is an unknown quantity at this point 
Solved Threads: 0
TraxionDesign TraxionDesign is offline Offline
Newbie Poster

Re: Facing the problem on "RedirectFromLoginPage"

 
0
  #3
Jul 17th, 2006
For a little more flexibility you can use the FormsAuthentication class to create the ticket and then manually redirect.


You can use your Web.config file to set specific users or check against a database. Then use the following to set up your ticket and redirect:

FormsAuthentication.SetAuthCookie(Uname.Text, False)

Response.Redirect("yourpage.aspx")

Thanks,

Dustin
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 233
Reputation: Lord Soth is an unknown quantity at this point 
Solved Threads: 4
Lord Soth's Avatar
Lord Soth Lord Soth is offline Offline
Posting Whiz in Training

Re: Facing the problem on "RedirectFromLoginPage"

 
0
  #4
Jul 27th, 2006
Hi,

You can use Server.Transfer instead of Response.Redirect to save a server round trip each time.

Loren Soth
Best regards,
Loren Soth

Crimson K. Software _________________________________________________________________ Crimson K. Blog
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 19
Reputation: Bharati Krishna is an unknown quantity at this point 
Solved Threads: 0
Bharati Krishna Bharati Krishna is offline Offline
Newbie Poster

Re: Facing the problem on "RedirectFromLoginPage"

 
0
  #5
Aug 5th, 2006
Hi,

The code for the Button_Click() of Login page.

Sub Button_Click(By Val As Object, By Val As EventArgs)
If IsValid Then
If FormsAuthentication.Authenticate(txtUsername.Text, txtPassword.Text) Then
FormsAuthentication.RedirectFromLoginPage(txtUsername.Tex,False)
Else
lblMessage.Text="Bad Username/Password")
End If
End If

End Sub

The above code will first check the username and password passed by the user. If they are valid, it will return true and then go to the next statement. Next, it creates an authentication cookie, attaches it to the outgoing response and redirects user to original requested page. The second parameter specifies whether the aurhentication should be a session cookie (false) or a persistent cookie(true).

the code for Default page

Sun Signout(ByVal objSender As Object,ByVal objArgs EventArgs)
FormsAuthentication.SignOut()
Response.Redirect(Request.UrlReferrer.ToString())

The code for Page_Load method

If user.Identity.IsAuthenticated Then
lblMessage.Text="Sucessful"
Else
lblMessage.Text="Sorry"
End if
End Sub


Regards
bhar
Knowledge is power
http://www.vkinfotek.com
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC