Click here to Skip to main content
13,551,695 members
Rate this:
Please Sign up or sign in to vote.
See more:
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;


           Response.Write(@"<script language='javascript'>alert('Invalid username or password!') </script>");



Posted 24-Dec-12 2:44am
Updated 24-Dec-12 3:12am
HashamAhmad 24-Dec-12 9:11am
please provide the code for

i think there must be some redirection being fired from there

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03-2016 | 2.8.180515.1 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100