Click here to Skip to main content
15,908,111 members

Comments by AhmedHosny96 (Top 22 by date)

AhmedHosny96 28-Dec-18 12:51pm View    
yeah here is my login.aspx page behind code
string s = ConfigurationManager.ConnectionStrings["RegistrationConnectionString2"].ConnectionString;

protected void LoginButton_Click1(object sender, EventArgs e)
{

if (Page.IsValid)
{

using (SqlConnection con = new SqlConnection(s))
{
SqlCommand cmd = new SqlCommand("spUserlogin", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@username", TextBoxUsername.Text);
cmd.Parameters.AddWithValue("@password", TextBoxPassword.Text);

SqlCommand cmd1 = new SqlCommand("spAdminlogin");
cmd1.CommandType = CommandType.StoredProcedure;

try


{
con.Open();
int value = (int)cmd.ExecuteScalar();
if (value == 1)
{

if (CheckBox1.Checked)
{
HttpCookie user = new HttpCookie("user_cookies"); //creating cookie object where user_cookies is cookie name
user["New"] = TextBoxUsername.Text; // cookie content
user.Expires = DateTime.Now.AddYears(3); // give the time/duration of cookie
Response.Cookies.Add(user); // it gives the response in browser
}
else
{
Session["New"] = TextBoxUsername.Text;
}
Response.Redirect("home.aspx");
}
else
{
Label_Login.Visible = true;
Label_Login.Text = "Use Correct username and password";

}

}

catch (Exception ex)
{
labelError.Visible = true;
labelError.Text = "Something went wrong! Contact your devloper " + ex.Message;
}
}
}

}
}
AhmedHosny96 17-Dec-18 15:10pm View    
thank u brother for every thing i have solved the error by generating the result in different way thanks for your help again <3 big hug
AhmedHosny96 17-Dec-18 2:52am View    
i will recommend python
AhmedHosny96 15-Dec-18 10:48am View    
@Richard Deeming still the issue remains unsolved what did u recommend..?
AhmedHosny96 14-Dec-18 15:51pm View    
sorry the problem starts from :
if (radioButton.Text == answer)
{
correctAnswers++;
totalMarks += marks;
}
else
{
incorrectAnswers++;
radioButton.Checked = false;
}

and stop until here
else if (radioButton.Text == answer)
{
correctAnswers++;
radioButton.Checked = true;

}

so what should i do .. ?