As said in the title Login control i used is not redirecting the same way it does when i log in first time. The problem is the first time i log in the redirect is correct(default.aspx) and after i LogOut and then Login again it takes me to the page i logged out from. I am out of ideas on what to do! Appreciate all help! Thanx!
<asp:Login ID="Login1" runat="server" DestinationPageUrl="~/Default.aspx" DisplayRememberMe="False"
TitleText="" UserNameLabelText="Username:" OnAuthenticate="Login1Authenticate"
FailureText="Incorrect username or password" Width="100%" VisibleWhenLoggedIn="False"
FailureAction="Refresh" >
</asp:Login>
protected void Login1Authenticate(object sender, AuthenticateEventArgs e)
{
var filecontent = Server.MapPath(@"~/App_Data/UsersFile.txt");
var lines = File.ReadAllLines(filecontent);
foreach (var line in lines)
{
if (line.Contains(@"username"))
{
var str = line; int index = str.IndexOf("=", StringComparison.Ordinal);
var newstr = str.Substring(index + 1);
Username = newstr.Trim();
}
if (line.Contains(@"password"))
{
var str = line; int index = str.IndexOf("=", StringComparison.Ordinal);
var newstr = str.Substring(index + 1);
Password = newstr.Trim();
}
if ((!Login1.UserName.Trim().Equals(Username)) || (!Login1.Password.Trim().Equals(Password))) continue;
e.Authenticated = true;
LogUserActions(Username, "Logged in successfully at: ");
break;
}
if (e.Authenticated) return;
LogUserActions(Username, "Failed to login in at: ");
LoginStatus1_ModalPopupExtender.Show();
}
Silly me when not noticing the
Loginstatusproperty on the page.This solved my problem after adding
LogoutActionandLogOutURL.