I am sorry I can't attach the file. SQL doesn't use any file (except a script to generate the table / stored procedures) that I can attach and send to you. It is not like an access mdb file.

Have you commented out the section of code I suggested and ran through the code line by line with break points?

Yes i am using Visual Studio?
but can you attach your file it may help in my stiuation
thanks

Thank you for the reply on the SP.

Another question, as i'm fairly new to C#.
How do i validate the next page that will open after the login, so that i can't link directly to the url that the login page is linking to.

regards
Train

Thank you for the reply on the SP.

Another question, as i'm fairly new to C#.
How do i validate the next page that will open after the login, so that i can't link directly to the url that the login page is linking to.

regards
Train

Did figure out to use "Session"

No problem.

I do indicate how to do this in the related tutorials described at the beginning of this tutorial in detail:

This can be done with a session object or a cookie

See here for dicussion on this : http://www.daniweb.com/techtalkforums/thread19303-2.html

Hope this helps. If you want more details let me know.

Thanks Paladine but i check more than ten times. it is still I will try with train quariy

I am sorry awaw, but I dont understand what you mean?

What is the problem you are having with using the Session Object? Stored Procedure?

FYI

Table code:

CREATE TABLE NorthWindUsers 
         (UserID INT IDENTITY(1,1) NOT NULL,
          UserName VARCHAR(50) NOT NULL,
          Password VARCHAR(50) NOT NULL)

FYI
Populate code:

INSERT INTO NorthWindUsers
 (UserName, Password)
 VALUES ('Admin', 'Admin')

FYI
Stored Procedure:

CREATE PROCEDURE sp_ValidateUser 
(
	 @UserName VARCHAR(50) = NULL,
	 @Password VARCHAR(50) = NULL,
	 @Num_of_User INT = 0
)
AS
	SET @Num_of_User = (SELECT COUNT(*) AS Num_of_User
	FROM NorthWindUsers
	WHERE UserName = @UserName AND Password = @Password)
RETURN  @Num_of_User

Thanks Paladine but i check more than ten times. it is still I will try with train quariy

thanks i finshed the project and fixed the problem.

Hi Paladine! Here is my code i have made in Access my DB and when i compile i get this errorr:
Cannot implicitly convert type 'int' to 'bool'


private bool test(string txtUser,string txtPassword)
{
OleDbConnection myConn = new OleDbConnection(ConfigurationSettings.AppSettings["strCon"]);
OleDbCommand myCmd = new OleDbCommand("proverka",myConn);
myCmd.CommandType = CommandType.StoredProcedure;
OleDbParameter objParam1,objParam2;
//OleDbParameter returnParam;
objParam1 = myCmd.Parameters.Add("@UserName",OleDbType.Char);
objParam2 = myCmd.Parameters.Add("@Password",OleDbType.Char);
//returnParam = myCmd.Parameters.Add("@ID",OleDbType.Integer);
objParam1.Direction = ParameterDirection.Input;
objParam2.Direction = ParameterDirection.Input;
//returnParam.Direction = ParameterDirection.ReturnValue;
objParam1.Value = txtUser;
objParam2.Value = txtPassword;

try
{
if(myConn.State == ConnectionState.Closed)
{
myConn.Open();
//myCmd.ExecuteNonQuery();
}
OleDbDataReader objReader;
objReader = myCmd.ExecuteReader(CommandBehavior.CloseConnection);
while(objReader.Read())
{
if((int)objReader.GetValue(0) = 0) //HERE IS THE ERROR
{
Label1.Text="Inavlid Login!";
return false;
}
else
{
objReader.Close();
return true;
}
}
}
catch(Exception ex)
{
Label2.Text = ex + "Error connecting to the DB!";
return false;
}
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnSubmit_Click(object sender, System.EventArgs e)
{
if(Page.IsValid)
{
if(test(txtUser.Text.Trim(),txtPassword.Text.Trim()))
{
FormsAuthentication.RedirectFromLoginPage(txtUser.Text,false);
}
else
{
Label1.Text = "Invalid Login,please try again!";
}
}
}

You have
(int)objReader.GetValue(0) which returns a value, an integer value to begin with so you shouldn't be converting it to int.

The GetValue Method "gets the value of specified column, by the ordinal position, in its native format".

Based on the tutorial code that value is the "Count" value which is an integer value. SQL does not count in decimals.

Hope this helps.

objReader = myCmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (objReader.Read()) 
                {

                    if ((bool)(objReader.GetValue(0)) == false)
                    {
                    
                    }
                }

hi,
i created a database and a table in my SQL server and then wrote the code behind given by u... i created the login page usin loginview and login button on the ASP.Net webform.... Wen buildin the code, it gives me followin errors...

Error 1 'ASP.login1_aspx.GetTypeHashCode()': no suitable method found to override c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\masterpages\f8dc24fc\1877bf0\App_Web_08fupc6s.4.cs 1054

Error 2 'ASP.login1_aspx.ProcessRequest(System.Web.HttpContext)': no suitable method found to override c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\masterpages\f8dc24fc\1877bf0\App_Web_08fupc6s.4.cs 1058

Error 3 'ASP.login1_aspx' does not implement interface member 'System.Web.IHttpHandler.IsReusable' c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\masterpages\f8dc24fc\1877bf0\App_Web_08fupc6s.4.cs 135

Error 4 Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl). C:\Phebe\Projects\Masterpages\login1.aspx.cs 1 33 C:\...\Masterpages\

the code is as follows

[
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace loginCsharp
{
public class login1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.LoginView LoginView1;
protected System.Web.UI.WebControls.TextBox UserName;
protected System.Web.UI.WebControls.TextBox Password;
protected System.Web.UI.WebControls.Label UserNameLabel;
protected System.Web.UI.WebControls.Label PasswordLabel;
protected System.Web.UI.WebControls.Label FailureText;
protected System.Web.UI.WebControls.Label FailureText2;
protected System.Web.UI.WebControls.Button LoginButton;
protected System.Web.UI.WebControls.RequiredFieldValidator UserNameRequired;
protected System.Web.UI.WebControls.RequiredFieldValidator PasswordRequired;
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary;
protected void Page_Load(object sender, EventArgs e)
{
}
#region Web Form Designer Generated Code
protected override void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponenet()
{
this.LoginButton.Click += new System.EventHandler(this.LoginButton_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void LoginButton_Click(object sender, System.EventArgs e)
{
if (Page.IsValid)
{
if (DBConnection(UserName.Text.Trim(), Password.Text.Trim()))
{
FormsAuthentication.RedirectFromLoginPage(UserName.Text, false);
}
else
FailureText.Text = "Invalid User Login!! Please Try Again!!"; 
}
}
private bool DBConnection(string txtUser, string txtPass)
{
SqlConnection myConn = new SqlConnection(ConfigurationSettings.AppSettings["strConn"]);
SqlCommand myCmd = new SqlCommand("sp_ValidateUser", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
SqlParameter objParam1;
SqlParameter objParam2;
SqlParameter returnParam;
objParam1 = myCmd.Parameters.Add("@UserName", SqlDbType.VarChar);
objParam2 = myCmd.Parameters.Add("@Password", SqlDbType.VarChar);
returnParam = myCmd.Parameters.Add("@No_of_User", SqlDbType.Int);
objParam1.Direction = ParameterDirection.Input;
objParam2.Direction = ParameterDirection.Input;
returnParam.Direction = ParameterDirection.ReturnValue;
objParam1.Value = txtUser;
objParam2.Value = txtPass;
try
{
if (myConn.State.Equals(ConnectionState.Closed))
{
myConn.Open();
myCmd.ExecuteNonQuery();
}
if ((int)returnParam.Value < 1)
{
FailureText.Text = "Invalid Login!!";
return false;
}
else
{
myConn.Close();
return true;
}
}
catch (Exception ex)
{
FailureText2.Text = ex + "Error Connecting to the database";
return false;
}
}
}
}
]

Microsoft.NET\Framework\v2.0.50727\

This is the reason, you are using this code which is for ASP.NET 1.1 and NOT ASP.NET 2.0. There are some significant differences between 1.1 and 2.0 framework that makes this code non-functional.

So if you want to use 2.0, you will have to debug and modify the code accordingly (I haven't had a free moment to post the 2.0 version of this code yet-- actually 2.0 has many things built in that streamline this). Recommend you check out http://www.asp.net/getstarted/default.aspx?tabid=61

For great video demos on creating a fully usable login and portal site.

Or if you are set on using 1.1, you will have to switch your default framework to 1.1 in IIS msc tool in windows.

Hope this helps

Thank You very much

Thanks a lot Paladine but when i have make like you have write to me and have try something else i always get this error:
'Login1.WebForm1.test(string, string)': not all code paths return a value

the function is:

privatebool test(string txtUser,string txtPassword)
{
OleDbConnection myConn = new OleDbConnection(ConfigurationSettings.AppSettings["strCon"]);
OleDbCommand myCmd = new OleDbCommand("proverka",myConn);
myCmd.CommandType = CommandType.StoredProcedure;
OleDbParameter objParam1,objParam2;
//OleDbParameter returnParam;
objParam1 = myCmd.Parameters.Add("@UserName",OleDbType.Char);
objParam2 = myCmd.Parameters.Add("@Password",OleDbType.Char);
//returnParam = myCmd.Parameters.Add("@ID",OleDbType.Integer);
objParam1.Direction = ParameterDirection.Input;
objParam2.Direction = ParameterDirection.Input;
//returnParam.Direction = ParameterDirection.ReturnValue;
objParam1.Value = txtUser;
objParam2.Value = txtPassword;
 
try
{
if(myConn.State == ConnectionState.Closed)
{
myConn.Open();
//myCmd.ExecuteNonQuery();
}
OleDbDataReader objReader;
objReader = myCmd.ExecuteReader(CommandBehavior.CloseConnection);
while(objReader.Read())
{
if((bool)(objReader.GetValue(0)) == false)
{
Label1.Text="Inavlid Login!";
return false;
}
else
{
objReader.Close();
return true;
}
}
}
catch(Exception ex)
{
Label2.Text = ex + "Error connecting to the DB!";
return false;
}
}

I have and another question?

How to make when login is sucesiful and will open the page default.aspx to show me for example in textbox or label the first name and second name of the user normaly if in the DB we have information about that.
For example "Welcome John Jonson"

hi! i was tested your code but i got an error..
i thing the error is in stored procedure...
pls send me the coding for stored procedure and table..

Thanks a lot Paladine but when i have make like you have write to me and have try something else i always get this error:
'Login1.WebForm1.test(string, string)': not all code paths return a value

the function is:

privatebool test(string txtUser,string txtPassword)
{
OleDbConnection myConn = new OleDbConnection(ConfigurationSettings.AppSettings["strCon"]);
OleDbCommand myCmd = new OleDbCommand("proverka",myConn);
myCmd.CommandType = CommandType.StoredProcedure;
OleDbParameter objParam1,objParam2;
//OleDbParameter returnParam;
objParam1 = myCmd.Parameters.Add("@UserName",OleDbType.Char);
objParam2 = myCmd.Parameters.Add("@Password",OleDbType.Char);
//returnParam = myCmd.Parameters.Add("@ID",OleDbType.Integer);
objParam1.Direction = ParameterDirection.Input;
objParam2.Direction = ParameterDirection.Input;
//returnParam.Direction = ParameterDirection.ReturnValue;
objParam1.Value = txtUser;
objParam2.Value = txtPassword;
 
try
{
if(myConn.State == ConnectionState.Closed)
{
myConn.Open();
//myCmd.ExecuteNonQuery();
}
OleDbDataReader objReader;
objReader = myCmd.ExecuteReader(CommandBehavior.CloseConnection);
while(objReader.Read())
{
if((bool)(objReader.GetValue(0)) == false)
{
Label1.Text="Inavlid Login!";
return false;
}
else
{
objReader.Close();
return true;
}
}
}
catch(Exception ex)
{
Label2.Text = ex + "Error connecting to the DB!";
return false;
}
}

Your code with the brackets located above have me a little puzzled. Be sure you can go through each logic path and have a return value!

hi! i was tested your code but i got an error..
i thing the error is in stored procedure...
pls send me the coding for stored procedure and table..

This is for ASP.NET 1.0 and 1.1 only, not 2.0 just as an FYI

Table

CREATE TABLE NorthWindUsers 
             (UserID INT IDENTITY(1,1) NOT NULL,
              UserName VARCHAR(50) NOT NULL,
              Password VARCHAR(50) NOT NULL)

Stored Procedure in SQL 2000

CREATE PROCEDURE sp_ValidateUser /* How it would appear in QUERY ANALYZER */
             (
                 @UserName VARCHAR(50) = NULL,
                 @Password VARCHAR(50) = NULL,
                 @Num_of_User INT = 0
             )
         AS
             SET @Num_of_User = (SELECT COUNT(*) AS Num_of_User
             FROM NorthWindUsers
             WHERE UserName = @UserName AND Password = @Password)
RETURN  @Num_of_User

Hope this helps

hi paladine! thanks for ur reply..
my problem was, stored procedure always returns 0 only..
so i got invalid login name only....

Web.Config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="strConn" value="Network Library=DBMSSOCN;Data Source=192.168.0.100,1433;database=Northwind;User id=;Password=;"/>
</appSettings>
<system.web>


<!--  DYNAMIC DEBUG COMPILATION
...

Me in a learner, i just copied and tried...im getting an error near
"strConn"..? what i must add there... may i know in a brief way... this is the one error im getting when im trying to run program..

Seshu

hi
this is dos here,
your job doing great, still i haning a course .net in c#. now what i need from your guys, just give simple console application mini project or ideas for that relative environment. than you.

hi paladine, i'm new to .net and was working on this login page,thanks a lot for ur tutorial...

i'm using MS access data base,database name is bank,i dont have any user id and password set.

</system.web>
<appSettings>
<add key="ConnectionString" value="User Id=;Password=;Data Source=bank;"/>
</appSettings>

in the code behind file

using System;
using System.Configuration;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Security;

namespace login
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox txtUserName;
protected System.Web.UI.WebControls.TextBox txtPassword;
protected System.Web.UI.WebControls.RequiredFieldValidator rvUserValidator;
protected System.Web.UI.WebControls.Button cmdSubmit;
protected System.Web.UI.WebControls.ValidationSummary Validationsummary1;
protected System.Web.UI.WebControls.Label lblMessage;
protected System.Web.UI.WebControls.Label lblMessage2;
protected System.Web.UI.WebControls.RequiredFieldValidator rvPasswordValidator;
public System.Data.OleDb.OleDbConnection conn;
public System.Data.OleDb.OleDbCommand dataCmd;
public System.Data.OleDb.OleDbDataReader objReader;

public System.Data.OleDb.OleDbDataReader dataRead;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
conn=new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\vamshi\\test\\bank.mdb");
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtUserName.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
this.cmdSubmit.Click += new System.EventHandler(this.cmdSubmit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void TextBox1_TextChanged(object sender, System.EventArgs e)
{

}
private void cmdSubmit_Click(object sender, System.EventArgs e)
{
if (Page.IsValid)
{
if (DBConnection(txtUserName.Text.Trim(), txtPassword.Text.Trim()))
{
FormsAuthentication.RedirectFromLoginPage (txtUserName.Text, false);
}
else
{
lblMessage.Text = "Invalid Login, please try again!";
}
}
}
private bool DBConnection(string txtUser, string txtPass)
{
if ( ConfigurationSettings.AppSettings ["ConnectionString"]== "") throw new Exception ("Connection String not found");
else
{
//SqlConnection myConn = new SqlConnection(ConfigurationSettings.AppSettings["strConn"]);

//SqlCommand myCmd = new SqlCommand("sp_ValidateUser", myConn);
conn=new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\vamshi\\test\\bank.mdb");
conn.Open();
dataCmd = new OleDbCommand("Query1" ,conn);
dataCmd.CommandType = CommandType.StoredProcedure;
OleDbParameter objParam1;
OleDbParameter objParam2;
//OleDbParameter returnParam;
//OleDbCommand comm = new OleDb.OleDbCommand(sql, conn);
objParam1=dataCmd.Parameters.Add("@userid",OleDbType.VarChar);
objParam2=dataCmd.Parameters.Add("@password",OleDbType.VarChar);
//returnParam=dataCmd.Parameters.Add("@Num_of_User",OleDbType.Integer);
objParam1.Direction = ParameterDirection.Input;
objParam2.Direction = ParameterDirection.Input;
//returnParam.Direction = ParameterDirection.ReturnValue;
//OleDbDataReader reader = dataCmd.ExecuteReader();

//SqlParameter objParam1;
//SqlParameter objParam2;
//SqlParameter returnParam;
//objParam1 = myCmd.Parameters.Add ("@UserName", SqlDbType.VarChar);
//objParam2 = myCmd.Parameters.Add ("@Password", SqlDbType.VarChar);
//returnParam = myCmd.Parameters.Add ("@Num_of_User", SqlDbType.Int);

objParam1.Value = txtUserName.Text;
objParam2.Value = txtPassword.Text;

try
{
if (conn.State.Equals(ConnectionState.Closed))
{
conn.Open();
dataCmd.ExecuteNonQuery();
}
//if ((int)returnParam.Value < 1)
objReader = dataCmd.ExecuteReader(CommandBehavior.CloseConnection);
while(objReader.Read())
{

if((bool)objReader.GetValue(0) == false)

{
lblMessage.Text = "Invalid Login!";
//return false;
}
else
{
conn.Close();
return true;
}
}
}
catch (Exception ex)
{
lblMessage2.Text = ex + "Error Connecting to the database";

}
}

return false;

}
}
}


when i compile i get an error connecting to the database...


can u plz help me with this..

thank u in advance

Hi again,well i figured out my errors,

1.the param values should be same in both asp and in access stored procedure.

2.if((bool)objReader.GetValue(0) == false)
needs to be changed to

if((int)objReader.GetValue(0) < 1)

Thanks again Paladine,GREAT Tutorials,i even went thru Simple Login Page using VB.NET,it was a great help where i learnt about the session and redirecting the user to the specific page...

thanks again.

hi sir, i am trying to develop a login page using C# but with MSAccess database.what should i do.how should i modify u r code? just by replacing SQL by OleDb or i should change the entire code?
please help me regarding this.

hi Rahilameen,the above code wat i hav written executes for MSAccess Database. :)

How to remove "Invalid Login, please try again!" message in label box after I entered a valid user name and password? Thanks for your assistance in advance...

hello, i am newbie .
can anyone please send me the code in c# and stored proc also with explanation.

hi i tried this but i am not getting output,if i give valid usename and password,its giving invalid

hai everyone..
i'm beginner in c#..i really needed ur help for login page..i already copy the coding before and it successfully run..but rite now, i want 2 specify the page that user will go after they're log in. for example, if accesslevel = 1, it will go to index.aspx.. if accesslevel = 2, it will go to index2.aspx.. i really hope someone can teach me to solve this problem..
i

here i put my code 4 more info...

using System;
using System.Data;
using System.Data.Odbc;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.SessionState;
using System.Web.Security;
using System.Security.Principal;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


namespace test
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


}


/* references from 1. http://www.programmingtalk.com/archive/index.php/t-2066.html
* 2. http://www.daniweb.com/forums/thread24148.html */
protected void cmdSubmit_Click(object sender, EventArgs e)
{


if (Page.IsValid)
{
if (DBConnection(txtUserName.Text, txtPassword.Text))
{
Session["name"] = txtUserName.Text;
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, true);
Response.Redirect("home.aspx");
}
else
{
lblMessage2.Text = "Account information is incorrect!";
}
}


}


private bool DBConnection(String txtUserName, String txtPassword)
{
bool authenticated;
OdbcParameter mail;
OdbcParameter pswd;
//OdbcParameter accesslevel;
string myscalar;


OdbcConnection myConn = new OdbcConnection(ConfigurationManager.ConnectionStrings["hrTraining"].ConnectionString);
OdbcCommand cmd = new OdbcCommand("SELECT email, password, name, id, userlevel FROM hris WHERE (email = '" + txtUserName + "' AND password = '" + txtPassword + "')", myConn);


mail = cmd.Parameters.Add("?email", OdbcType.Char, 40);
mail.Value = txtUserName;


pswd = cmd.Parameters.Add("?password", OdbcType.VarChar, 40);
pswd.Value = txtPassword;


//accesslevel = cmd.Parameters.Add("?userlevel", OdbcType.Int);


myConn.Open();
//cmd.ExecuteNonQuery();


OdbcDataReader reader = cmd.ExecuteReader();


if (reader.Read())
{
myscalar = cmd.ExecuteScalar();
Session["userID"] = myscalar;
authenticated = true;
}
else
{
authenticated = false;
}


reader.Close();
myConn.Close();
myConn.Dispose();


return authenticated;
}
}
}

Help
I am new to asp .net #c and i am trying to use your simple asp.net login page using C# to learn more about asp .net #c. I have copied to see how it looks and i get the following error:
Parser Error Message: Could not load type 'NorthCSharp.WebForm1'.
What am i doing wrong? Can this code just be copied to show me how it looks?
Also, i understand the connection to database, i want to connect it to a ms Sql database which i have the connection string for but i want to create a sql command to do the username and password search. Can this be done with this code?

how do i implement cancel or exit button here????

i added it n did this in my aspx.cs but doesn' seem to work...
plz. help.. itz urgent

 protected void cmdExit_Click(object sender, EventArgs e)
    {
        this.rvUserValidator.Enabled = false;
        this.rvUserValidator.Dispose();  

        this.rvPasswordValidator.Enabled = false;
        this.rvPasswordValidator.Dispose();

        this.Validationsummary1.Visible = false;
        this.lblMessage.Visible = false;
        this.lblMessage.Enabled = false;

        this.lblMessage2.Visible = false;
        this.lblMessage2.Enabled = false;

    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.