本文介绍了如何将System.Web.UI.HtmlControls.HtmlInputText值转换为字符串!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我想将System.Web.UI.HtmlControls.HtmlInputText值转换为字符串。
实际上我正在使用身份验证功能,其中我正在使用HTML控件:
Hi I want to convert System.Web.UI.HtmlControls.HtmlInputText value into string.
Actually I am using authentication function in which i am using HTML controls :
private void Authenticate_User(System.Web.UI.HtmlControls.HtmlInputText username, System.Web.UI.HtmlControls.HtmlInputText password)
{
//-- doing some code here & Save credentials into cookies.
}
现在我检查上面的功能page_load:
Now I am check above function on page_load :
protected void Page_Load(object sender, EventArgs e)
{
string userid = Request.Cookies["UserDetails"]["UserName"].ToString();
string pass = Request.Cookies["UserDetails"]["Password"].ToString();
Authenticate_User(userid, pass); //---- It gives some conversation error (HTML contorl to string )
}
任何建议都非常感谢。
推荐答案
protected void Page_Load(object sender, EventArgs e)
{
string userid = Request.Cookies["UserDetails"]["UserName"].ToString();
string pass = Request.Cookies["UserDetails"]["Password"].ToString();
Authenticate_User(new System.Web.UI.HtmlControls.HtmlInputText() {Value=userid }, new System.Web.UI.HtmlControls.HtmlInputText() {Value=pass });
};
这篇关于如何将System.Web.UI.HtmlControls.HtmlInputText值转换为字符串!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!