Brendon_vbulletin3_import12785
New Member
@Habiblast time it was pbl with the enc and storing it the db and now the pbl is in dec and retrieving the data from the db it is showing the error as\[quote\] The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters\[/quote\]code is like this:\[code\]using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Security.Cryptography;using System.Data.SqlClient;namespace WebApplication5{ public partial class WebForm4 : System.Web.UI.Page { SqlConnection connection; protected void Page_Load(object sender, EventArgs e) { connection = new SqlConnection(ConfigurationManager.ConnectionStrings["TestQueryConnectionString"].ConnectionString); } protected void btnSubmit_Click(object sender, EventArgs e) { SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["TestQueryConnectionString"].ConnectionString); con1.Open(); SqlCommand cmd1 = new SqlCommand("select * from admin where USERNAME=@USERNAME and PASSWORD=@PASSWORD ", con1); cmd1.Parameters.AddWithValue("@username", txtUserName.Text); string strpassword = DecodeFrom64(txtPassword.Text); cmd1.Parameters.AddWithValue("@password", txtPassword.Text); SqlDataAdapter da = new SqlDataAdapter(cmd1); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { Response.Redirect("emplist.aspx"); } else { ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('Invalid Username and Password')</script>"); } con1.Close(); } protected void btnClear_Click(object sender, EventArgs e) { txtUserName.Text = ""; txtPassword.Text = ""; } public string DecodeFrom64(string encodedData) { System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); System.Text.Decoder utf8Decode = encoder.GetDecoder(); byte[] todecode_byte = Convert.FromBase64String(encodedData); int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); char[] decoded_char = new char[charCount]; utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); string result = new String(decoded_char); return result; } }}\[/code\]plz solve me this pbl too Habib....,thankyou for the last one...,