Chris Ara
01-09-2007, 07:16 AM
I'm having trouble with my log in page code. Once you successfuly log in from the log in page you are redirected to a home page. The home page and all the other pages work properly until you log in. Once you transfer after the log in it will load two copies of the home page at the same time ???? Then all the buttons and links on the home page won't work , if you redirect then come back to sight after you have logged in (without closing the window) the buttons and links will work once again and there will only be one copie of the page loaded into your browser. Here is the code for the login page tell me if you see anything that would cause this.
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs)
Try
Dim Reader As New IO.StreamReader(Server.MapPath("." & "/profiles/" & LoginUser.UserName.ToLower & ".txt"))
Dim Age As String = Reader.ReadLine
Dim Sex As String = Reader.ReadLine
Dim Location As String = Reader.ReadLine
Dim Hobbies As String = Reader.ReadLine
Dim Quote As String = Reader.ReadLine
Dim Picture As String = Reader.ReadLine
Dim PassWord As String = Reader.ReadLine
Reader.Close()
If LoginUser.Password.ToLower = PassWord.ToLower Then
Session("User") = LoginUser.UserName.ToLower
Session("PassWord") = LoginUser.Password.ToLower
Session("Profile") = "None"
Server.Transfer("Home.aspx")
End If
Catch ex As Exception
Server.Transfer("LogIn.aspx")
End Try
End Sub
As you can see basically I am loading a profile from a text file then checking the password in the file against the password in the password box if the passwords match then you are redirected to the home page.
thanks for any help
Chris Ara
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs)
Try
Dim Reader As New IO.StreamReader(Server.MapPath("." & "/profiles/" & LoginUser.UserName.ToLower & ".txt"))
Dim Age As String = Reader.ReadLine
Dim Sex As String = Reader.ReadLine
Dim Location As String = Reader.ReadLine
Dim Hobbies As String = Reader.ReadLine
Dim Quote As String = Reader.ReadLine
Dim Picture As String = Reader.ReadLine
Dim PassWord As String = Reader.ReadLine
Reader.Close()
If LoginUser.Password.ToLower = PassWord.ToLower Then
Session("User") = LoginUser.UserName.ToLower
Session("PassWord") = LoginUser.Password.ToLower
Session("Profile") = "None"
Server.Transfer("Home.aspx")
End If
Catch ex As Exception
Server.Transfer("LogIn.aspx")
End Try
End Sub
As you can see basically I am loading a profile from a text file then checking the password in the file against the password in the password box if the passwords match then you are redirected to the home page.
thanks for any help
Chris Ara