전회 이제 PBL 십이이고 입력이없는하나
같이 DB로부터 데이터를 검색하는 것이 오차를 보이고
: 그것과 같은 유효한 자료-64 문자열이 아닌 기본을
코드이처럼 패딩 문자 중 64 문자, 두 개 이상의 패딩 문자 또는 공백이 아닌 문자가 포함
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 [email protected] and [email protected] ", 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;
}
}
}
@ user2189723 적절한 사용자 이름을 지정하십시오. –
당신은 질문에서 어떤 사람을 태깅하지 않았고/붙일 수 없다. 새로운 문제가 새로운 질문을하는 경우 나는 말했다. 또한 당신은 질문에 더 나은 제목을 줄 필요가 있습니다 그렇지 않으면 downvotes 얻을 수 있습니다. – Habib
속기를 사용하는 대신 전체 단어를 써주십시오. "pbl"및 "enc"와 같은 것을 쓰는 방법은 질문을 매우 어렵게 만듭니다. – jadarnel27