Hi...
I've this exception while i am entering user details with password in encrypted format..pls go through...
Pls find solution..
protected void btnSubmit_Click(object sender, EventArgs e)
{
string Uid = txtUserId.Text.Trim();
//string Pwd = txtPassword.Text.Trim();
//System.Text.ASCIIEncoding encryptPwd = new System.Text.ASCIIEncoding();
//byte[] bpwdArray = encryptPwd.GetBytes(Pwd);
string Pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.Trim(), "MD5");
string Name = txtName.Text.Trim();
string DesigCode = txtDesigCode.Text.Trim();
string Email = txtEmail.Text.Trim();
string TelNo = txtTelNo.Text.Trim();
string HandPhNo = txtHandPhone.Text.Trim();
string active = ddlActive.SelectedValue;
try
{
SqlConnection cnn = new SqlConnection(Conn);
SqlCommand cmd = new SqlCommand("spAddUserDetails", cnn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Uid", Uid);
cmd.Parameters.AddWithValue("@Pwd", Pwd);
cmd.Parameters.AddWithValue("@Name", Name);
cmd.Parameters.AddWithValue("@DesigCode", DesigCode);
cmd.Parameters.AddWithValue("@Email", Email);
cmd.Parameters.AddWithValue("@TelNo", TelNo);
cmd.Parameters.AddWithValue("@HandPhNo", HandPhNo);
cmd.Parameters.AddWithValue("@active", active);
SqlDataAdapter ada = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
ada.Fill(ds);
txtUserId.Text="";
txtPassword.Text = "";
txtName.Text = "";
txtDesigCode.Text = "";
txtEmail.Text = "";
txtTelNo.Text = "";
txtHandPhone.Text = "";
ClientScript.RegisterStartupScript(GetType(), "Message", "<script language='javascript'>alert('Record Inserted Successfully');</script>");
}
catch (Exception ex)
{
ClientScript.RegisterStartupScript(GetType(), "Message", "<script language='javascript'>alert('" + ex.Message.ToString() + "');</script>");
}
finally
{
}
}
Join Hands Change lives
Thanks & Regards
Straight Edge Society