2.0: forms authentication on image button click

R

R.A.M.

Hi,
I need your help with login implementation in my ASP.NET 2.0 demo
application.
I have custom login control on my default.aspx page:

....
<form id="LoginForm" runat="server"
method="post" action="Welcome.aspx" style="vertical-align:
middle;">
<asp:ImageButton ID="DotNETImage" runat="server"
ImageUrl="~/Images/DotNET_360x280.jpeg"
AlternateText="Microsoft .NET version 2.0"
Width="360" Height="280"
OnClick="OnClickImage" />
<asp:placeHolder ID="LoginPlaceHolder" runat="server" />
</form>
....
public partial class DefaultPage : System.Web.UI.Page
{
class DemoLogin : Login
{
public DemoLogin(string ID) : base()
{
this.ID = ID;
...
}
override protected void OnAuthenticate(AuthenticateEventArgs
e)
{
e.Authenticated = (UserName != "" && Password == "demo");
}
}
private DemoLogin login;
private void Page_Load(object sender, EventArgs e)
{
login = new DemoLogin("DemoLogin");
LoginPlaceHolder.Controls.Add(login);
}
// Image button clicked:
public void OnClickImage(object sender, EventArgs e)
{
// Here I would like to call authentication!
}
}
....

I would like to call authentication procedure when image button is
pressed - equivalence of Login button click; perhaps I should raise
login.Authenticate event but I don't know how. Could you help me
please?

Thank you for your answers!
/RAM/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top