Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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 :
C#
private void Authenticate_User(System.Web.UI.HtmlControls.HtmlInputText username, System.Web.UI.HtmlControls.HtmlInputText password)
    {
//-- doing some code here & Save credentials into cookies.
    }


Now I am check above function on page_load :
C#
 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 )

}


Any suggestion really appreciate.
Posted
Updated 2-Apr-13 1:38am
v4
Comments
pradiprenushe 2-Apr-13 6:57am    
Your method takes htmlinput & you are passing string. Chang your function to
private void Authenticate_User(String username, String password)
Mas11 2-Apr-13 7:12am    
Ya, I know! but I was using: Authenticate_User(userid, pass) many time & its really hard to change the code. Do you have any idea regarding type cast string into htmlinput.

1 solution

Hi Guys I have solved this by some one help !
C#
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 });
};
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900