1
Good afternoon,
I am 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 complicate when I want to use the FormsAuthentication
that causes the error of infinite forwarding and can not open the site, reaching the limit.
I’ve already changed the maxUrl
and the maxUrl
and nothing.
<requestLimits maxUrl="10999" maxQueryString="2097151" />
I’ve 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’ve also cleared Chrome Cookies and nothing, tried with other browser and the problem appears equal or worse. What am I doing wrong? What is the solution to my problem?
Good morning, I apologize for the delay in answering. I did as indicated but that same error continues, it is possible that I am missing some part of code?
– Kawaii