Good afternoon,
I'm developing an ASP.NET application with C # that requires login, works and is being used this way:
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["FARMConnectionString"].ConnectionString);
conn.Open();
string checkuser = "select count(*) from colaboradores where nrColaborador='" + TextBox1.Text + "'";
SqlCommand com = new SqlCommand(checkuser, conn);
int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
conn.Close();
if (temp == 1)
{
conn.Open();
string checkPasswordQuery = "select psw from colaboradores where nrColaborador='" + TextBox1.Text + "'";
SqlCommand passCom = new SqlCommand(checkPasswordQuery, conn);
string password = passCom.ExecuteScalar().ToString().Replace(" ", " ");
if (password == TextBox2.Text)
{
Session["New"] = TextBox1.Text;
FormsAuthentication.RedirectFromLoginPage(temp.ToString(), true);
Response.Redirect("Menu.aspx");
}
else
{
Response.Write("Username ou Password errados");
}
}
}
So far so good, things get complicated when I want to use FormsAuthentication
that causes the infinite relay error and can not open the site, reaching the limit.
I already changed maxUrl
and maxUrl
and nothing.
<requestLimits maxUrl="10999" maxQueryString="2097151" />
I have already modified the authentication-mode
and the authorizathion
and also nothing:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" defaultUrl="Menu.aspx"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
I have also cleaned Chrome Cookies and nothing, tried other browsers and the problem appears the same or worse. What am I doing wrong? What is the solution to my problem?