As I have posted previously when a user logs into the site I do the following
At this point a link to the admin page is shown
When the user clicks the link I do the following in the page load
This works fine if the user clicks the link but if they type the direct address into their browser it does not.
Is there another event that fires when the address is typed in directly? Any other ways to handle this?
Oh, I also found that when I used the HttpContext.Current.User.Identity.IsAuthenticated on the admin page it always evaluates to true no matter what.
Code:
protected void submit_Click(object sender, EventArgs e)
{
s_Username = this.username.Text.Trim();
s_Password = this.password.Text.Trim();
this.lblMessage.Text = "";
try
{
i_UserID = m_DAL.ValidateLogin(s_Username, s_Password);
if (i_UserID != -1)
{
m_User = new User(i_UserID);
m_Pub.Usr = m_User;
if (m_User.UserID != 0)
{
//all is well
FormsAuthentication.SetAuthCookie(m_User.UserID.ToString(), true);
}
else
{
//there was a problem getting the user
this.lblMessage.Text = "Your Login Attempt Was Unsuccessful";
FormsAuthentication.SignOut();
}
}
else
{
//something wrong
this.lblMessage.Text = "Your Login Attempt Was Unsuccessful";
FormsAuthentication.SignOut();
}
}
catch
{
FormsAuthentication.SignOut();
}
}
At this point a link to the admin page is shown
When the user clicks the link I do the following in the page load
Code:
m_Pub = new Pub();
m_User = m_Pub.Usr;
if (m_User != null)
{
//Process page
}
else
{
FormsAuthentication.SignOut();
Response.Redirect("default.aspx");
}
This works fine if the user clicks the link but if they type the direct address into their browser it does not.
Is there another event that fires when the address is typed in directly? Any other ways to handle this?
Oh, I also found that when I used the HttpContext.Current.User.Identity.IsAuthenticated on the admin page it always evaluates to true no matter what.