Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 login with timeout

Author  Topic 

yvette
Yak Posting Veteran

74 Posts

Posted - 2010-10-18 : 10:35:25
Hi,
i've a login page and i write the code below.

protected void btnLogin_Click(object sender, EventArgs e)
{
SqlDataSource sds = new SqlDataSource();
sds.ConnectionString = ConfigurationManager.ConnectionStrings["cwConnectionString"].ToString();

sds.SelectParameters.Add("UserName", TypeCode.String, this.txtUserName.Text);
sds.SelectParameters.Add("Password", TypeCode.String, this.txtPassword.Text);

sds.SelectCommand = "SELECT [UserName], [Password] FROM [Profile] WHERE [UserName] = @UserName AND [Password] = @Password";

DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty);
try
{
if (dv.Count == 0)
{
this.lblStatus.ForeColor = System.Drawing.Color.Red;
this.lblStatus.Text = "Invalid username and password!";
return;
}
else
{
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, true);
}
}
catch
{

}
finally
{

}
}

Can somebody help me to add some statement which have timeout session??? because i try many time but i can't get what i want.

Thanks for help....

jafrywilson
Constraint Violating Yak Guru

379 Posts

Posted - 2010-10-19 : 00:54:53
I hope this will help you..

http://msdn.microsoft.com/en-us/library/ms525473%28VS.90%29.aspx
Go to Top of Page
   

- Advertisement -