Telerik bibilotheque 的小问题。问题来自我的登录页面,或者我使用了两个字段:(登录名和密码)与控制器“radcombobox”。每次我返回登录页面时,登录信息都会被保存并通过 cookie 重写字段。直到一切正常。但是当我点击按钮连接时。我将返回错误登录....我不明白为什么,因为字段的值看起来不错。
!!如果我使用 [asp:textbox] 一切都很好,但没有 [radtextbox] .. 这是我的两个字段的代码(使用按钮的登录名和密码)非常感谢
<tr>
<td class="labelCo">
<asp:Label ID="lbLogin" runat="server" Text='<%$ Resources:IRM, user_label_identity %>'></asp:Label>
</td>
</tr>
<tr>
<td class="inputCo">
<telerik:RadTextBox ID="txtBoxLogin" Runat="server" Width="300px" AutoCompleteType="None">
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td class="labelCo">
<asp:Label ID="lbPassword" runat="server" Text='<%$ Resources:IRM, user_label_password %>' ></asp:Label>
</td>
</tr>
<tr>
<td class="inputCo">
<telerik:RadTextBox ID="txtBoxPassword" Runat="server" TextMode="Password" AutoCompleteType="None" Width="300px" ></telerik:RadTextBox>
</td>
</tr>
<tr>
<td class="btnconectCo">
<asp:Button ID="btnConnect" runat="server" Text='<%$ Resources:IRM, global_button_connect %>' OnClick="btnConnect_Click" />
</td>
</tr>
和 buttonClick ... 一个长代码 ^^
try
{
string name;
string password;
name = txtBoxLogin.Text.Replace("'", ""); ;
password = txtBoxPassword.Text.Replace("'", "");
if (name.Trim().Length >= 3 && password.Length >= 3)
{
general_function myFunction = new general_function(ConfigurationManager.ConnectionStrings["SCI2ConnectionString"].ConnectionString);
//Récupère la connection de l'utilisateur dans la BD ARMS_USER
string[,] resultArmsUser = myFunction.sql_request2D("getInfoUserAuthentification '" + name.Trim() + "','" + password.Trim() + "'");
int countConnection = resultArmsUser.GetLength(0);
if (countConnection > 1)
{
object[] sessionUser = new object[4];
sessionUser[0] = resultArmsUser[0, 1]; //login
sessionUser[1] = password; //stock le password
sessionUser[3] = resultArmsUser; //Stocke les infos du user
Session["sessionUser"] = sessionUser;
Session["user_name"] = name;
Session["user_password"] = password;
Session["userDb"] = null;
string res = string.Empty;
for (int a = 0; a < resultArmsUser.GetLength(0); a++)
{
res += resultArmsUser[a, 5].ToString() + "#" + resultArmsUser[a, 3].ToString() + "{-}";
}
Session["userDb"] = res;
creatTableConnection_withoutWindowsLogin(countConnection, resultArmsUser);
}
else
{
if (resultArmsUser[0, 0] != "")
{
string userID = myUser.getUserIDAtAuthentification(name, password, resultArmsUser[0, 3]);
if (userID != "")
{
myFunction = new general_function(resultArmsUser[0, 3]);
Session["logged"] = true;
Session["userID"] = userID;
Session["user_name"] = name;
Session["user_password"] = password;
string[,] nothing = new string[0, 0];
myFunction.addActivity("user", int.Parse(userID), "access", int.Parse(userID), nothing, 1, 0);
//Création de l'objet user
object[] sessionUser = new object[4];
sessionUser[0] = resultArmsUser[0, 1]; //Login
sessionUser[1] = resultArmsUser[0, 3]; //ConnectionStrings
sessionUser[2] = userID; //UserID
sessionUser[3] = resultArmsUser[0, 4]; //connectionStringID
Session["sessionUser"] = sessionUser;
Session["userDb"] = null;
string res = string.Empty;
for (int a = 0; a < resultArmsUser.GetLength(0); a++)
{
res += resultArmsUser[a, 5].ToString() + "#" + resultArmsUser[a, 4].ToString() + "{-}";
}
Session["userDb"] = res;
//Flag à true le champ actif de la table tblUser
user t = new user(resultArmsUser[0, 3], int.Parse(userID));
t.isActif = true;
if (Session["page"] != null)
{
string page = Session["page"].ToString();
if (page.Equals("finance.aspx"))
{
Response.Redirect("Finance/" + page);
}
else
{
Response.Redirect(page);
}
}
else
{
Response.Redirect("Default.aspx");
}
}
else
{
lbInfo.Text = myFunction.getResource("user_label_error_password_incorrect");
lbInfo.ForeColor = Color.Red;
Session["logged"] = null;
}
}
else
{
lbInfo.Text = myFunction.getResource("user_label_error_password_incorrect");
lbInfo.ForeColor = Color.Red;
Session["logged"] = null;
}
ContentPlaceHolder menuActive;
DropDownList cbbx_dbUser;
menuActive = (ContentPlaceHolder)Master.FindControl("menuActive");
cbbx_dbUser = (DropDownList)menuActive.FindControl("cmbx_dbListUser");
object[] myUserSession = (object[])Session["sessionUser"];
general_function myFunction_ = new general_function(ConfigurationManager.ConnectionStrings["SCI2ConnectionString"].ToString());
string resDbName = myFunction_.sql_request2D("getConnectionStringName " + myUserSession[3].ToString())[0, 0];
int index = 0;
for (int b = 0; b < cbbx_dbUser.Items.Count; b++)
{
string value = cbbx_dbUser.Items[b].Text;
//Si la corresspondance est parfaite avec la db utilisée actuellement on effetue la selection par defaut
if (value.ToLower().Trim().Equals(resDbName.ToLower().Trim()))
{
cbbx_dbUser.SelectedIndex = index;
}
index++;
}
}
}
else
{
general_function myFunction = new general_function(ConfigurationManager.ConnectionStrings["SCI2ConnectionString"].ConnectionString);
lbInfo.Text = myFunction.getResource("user_label_enter_login");
lbInfo.ForeColor = Color.Green;
}
}
catch (Exception er)
{
}