How to Send user to two different web pages when login

Posted by Pradeep on Stack Overflow See other posts from Stack Overflow or by Pradeep
Published on 2010-03-22T14:22:07Z Indexed on 2010/03/22 14:31 UTC
Read the original article Hit count: 563

Filed under:
|
|
protected static Boolean Authentication(string username, string password)
{
    string sqlstring;
    sqlstring = "Select Username, Password, UserType from Userprofile WHERE Username='" + username + "' and Password ='" + password + "'";

    // create a connection with sqldatabase 
    System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(
                 "Data Source=PRADEEP-LAPTOP\\SQLEXPRESS;Initial Catalog=BookStore;Integrated Security=True");

    // create a sql command which will user connection string and your select statement string
    System.Data.SqlClient.SqlCommand comm = new System.Data.SqlClient.SqlCommand(sqlstring, con);

    // create a sqldatabase reader which will execute the above command to get the values from sqldatabase
    System.Data.SqlClient.SqlDataReader reader;

    // open a connection with sqldatabase
    con.Open();

    // execute sql command and store a return values in reade
    reader = comm.ExecuteReader();

    // check if reader hase any value then return true otherwise return false
    if (reader.Read())
        return true;
    else
        return false;
}

Boolean blnresult;

blnresult = Authentication(Login2.UserName, Login2.Password);

if (blnresult == true)
{
    Session["User_ID"] = getIDFromName(Login2.UserName);
    Session["Check"] = true;
    Session["Username"] = Login2.UserName;

    Response.Redirect("Index.aspx");
}

so a user like Staff or even Administrators loging to same Index.aspx. i want to change it to different web pages.

how to change sites for each user types. i have seperate user types. and i have taken UserType in the Authentication function.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET