TRY THIS WAY
<asp:login id="ctlLogin" runat="server" onauthenticate="OnAuthenticate"
onloggedin="OnLoggedIn" onloggingin="OnLoggingIn" destinationpageurl="~">
</asp:login>
protected void OnAuthenticate(object sender, AuthenticateEventArgs e)
{
e.Authenticated = false;
if (String.Compare(ctlLogin.UserName, "foo", true) == 0 &&
String.Compare(ctlLogin.Password, "bar", false) == 0)
{
e.Authenticated = true;
}
}
protected void OnLoggedIn(object sender, EventArgs e)
{
Response.Redirect("~");
}