In that I did authentication in Asp.net.
Now I want to send that result in XML format.
Can any one help please?
Here is my code:
Expand|Select|Wrap|Line Numbers
- protected void Page_Init(object sender, EventArgs e)
- {
- string username = Request.QueryString["username"];
- string password = Request.QueryString["password"];
- int response;
- string constr = "Data Source=ITS-BA-DC02\\MSSQL2008_SAND;Initial Catalog=TestDB_Chaitanya;User ID=sa;Password=01Explore";
- SqlConnection conn = new SqlConnection(constr);
- conn.Open();
- SqlCommand cmd = new SqlCommand("select username, password from users where username = '" + username + "'and password='" + password + "'", conn);
- SqlDataReader dr = cmd.ExecuteReader();
- if (dr != null && dr.HasRows)
- {
- string str = "Login Successful!";
- Response.Write(str);
- }
- else
- {
- string str1 = "Invalid username or password!";
- Response.Write(str1);
- }
- }
- }