ERROR:This webpage has a redirect loop
The webpage at http://localhost:12205/kreu.aspx?ReturnUrl=%2findex.aspx has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
I have created a login system like this but when i run it gives the error
protected void btn_login_Click(object sender, EventArgs e)
string strCon = ConfigurationManager.ConnectionStrings["ConnectionStringusers"].ConnectionString;
string strSelect = "SELECT COUNT(*) FROM [Users] WHERE UserName = @Username AND Password = @Password";
SqlConnection con = new SqlConnection(strCon);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = strSelect;
SqlParameter username = new SqlParameter("@Username", SqlDbType.VarChar, 50);
username.Value = username_id.Value.Trim().ToString();
SqlParameter password = new SqlParameter("@Password", SqlDbType.VarChar, 50);
password.Value = password_id.Value.Trim().ToString();
int result = (Int32)cmd.ExecuteScalar();
if (result >= 1)
Session["username"] = username_id.Value;
Change the url to something else to verify the issue is/isn't in your shown code will help know where the issue is.
Like HashamAhmad said, if it doesn't happen when you change the url then you would need to show the kreu.aspx code to verify where the issue is.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)