plz any body clear my doubt.............

Posted by Kukkanti.Nagaraju under ASP.NET on 3/27/2012 | Points: 10 | Views : 680 | Status : [Member] | Replies : 3
how to encode the data and decode the data means Eg how to store the login details and password which should encode in the database and whenever the person login in second time
he enters login and password at that time we should decode the data which we stored in the database table

Nraju


Responses

Posted by: Sabarimahesh on: 3/27/2012 [Member] Bronze | Points: 25

Up
0
Down
Try this Code .....


                                                                     




public partial class _Default : System.Web.UI.Page
{


string n,p;
// int c;
SqlConnection con =new SqlConnection("data source=indu-e4a2942f5d\\sqlexpress;integrated security=true;database=billut");

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.ViewState["count"] = 0;
}
}
public void m1()

{


con.Open();
SqlCommand com = new SqlCommand("select*from kum where userid='" + TextBox1.Text + "'", con);
SqlDataReader dr;
dr = com.ExecuteReader();
while (dr.Read())
{
n = dr[0].ToString();
p = dr[1].ToString();
}
dr.Close();
if (TextBox1.Text == n && TextBox2.Text == p)
{
Label3.Text = "Valid";
}
else
{
Label3.Text = "invalid";
}



con.Close();

}




protected void Button1_Click(object sender, EventArgs e)

{
int i = int.Parse(this.ViewState["count"].ToString())+1;
this.ViewState["count"] = i;

if (i <= 3)
{


m1();
}

else
{
Label4.Text = "no";
}


}


}




{
for (i = 0; i < 2; i++)
{

m1();


}

}
else
{
Label3.Text = "no";
}
}
}


Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Kukkanti.Nagaraju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 3/27/2012 [Member] Silver | Points: 25

Up
0
Down

Hi,
You can use MD5 password technique and store encoded password in database.
Refer to this for a source code example.
http://www.aspnettutorials.com/tutorials/advanced/md5-secret-aspnet2-csharp.aspx

Thanks,
Sanjay

Kukkanti.Nagaraju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 3/28/2012 [Member] Bronze | Points: 25

Up
0
Down
Sksamantaray

Yes

A new Thing You Said

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Kukkanti.Nagaraju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response