Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

one login form

$
0
0

hey all

i want to create one login form ina sp.net using c#

in my database 2 users are admina nd user

now i create a login code 

here is code

public partial class login2 : System.Web.UI.Page
    {
        admin ab = new admin();
        protected void Page_Load(object sender, EventArgs e)
        {
            char[] chs = { '/' };
            string[] strs = Request["ReturnUrl"].Split(chs);


            if (strs[1] == "Admin")
            {
                Response.Redirect(@"\Admin\Login.aspx");
            }
            else if (strs[1] == "Users")
            {
                Response.Redirect(@"\Users\Login.aspx");
            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            DataTable a = ab.getUser((TXT_NAME.Text,TXT_PASWORD.Text));
            
            //DataTable a = ClassLibrary1.admin.((TXT_NAME.Text));
            if (a.Rows.Count > 0)
            {
                HiddenField1.Value = a.Rows[0]["password"].ToString();
                HiddenField_user.Value = a.Rows[0]["userID"].ToString();
                HiddenField_usertype.Value = a.Rows[0]["usertypeID"].ToString();
                Session["User_id"] = HiddenField_user.Value;
                Session["user_name"] = TXT_NAME.Text;
                if (TXT_PASWORD.Text == HiddenField1.Value)
                {
                    Session["LoginID"] = a.Rows[0]["UserID"];
                    if (HiddenField_usertype.Value == "1")
                    {
                        Response.Redirect("polling.aspx");
                    }
                    else
                    {
                        Response.Redirect("pollingstart.aspx?user=student");

                    }
                }
                else
                {
                    Label1.Text = "Incorrect username or password";
                }

            }
            else
            {
                Label1.Text = "Incorrect username or password";
            }


        }
    }

when i run code then following  error begin 

Error 1    ) 

Error 3    ; 

Error 2     Invalid expression term ')' 

these error beign in this line 

DataTable a = ab.getUser((TXT_NAME.Text,TXT_PASWORD.Text));



how i solve this issue 

thankx


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>