Click here to Skip to main content
15,889,335 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: error in showing blogs in the web site Pin
Amit Spadez9-Dec-09 0:07
professionalAmit Spadez9-Dec-09 0:07 
GeneralRe: error in showing blogs in the web site Pin
rahuuul179-Dec-09 0:12
rahuuul179-Dec-09 0:12 
GeneralRe: error in showing blogs in the web site Pin
Dinesh Mani9-Dec-09 0:22
Dinesh Mani9-Dec-09 0:22 
QuestionPaging toGridView Pin
rahul.net118-Dec-09 23:13
rahul.net118-Dec-09 23:13 
AnswerRe: Paging toGridView Pin
Blue_Boy8-Dec-09 23:30
Blue_Boy8-Dec-09 23:30 
GeneralRe: Paging toGridView Pin
rahul.net118-Dec-09 23:41
rahul.net118-Dec-09 23:41 
GeneralRe: Paging toGridView Pin
Blue_Boy8-Dec-09 23:44
Blue_Boy8-Dec-09 23:44 
Questionerror in the login web page Pin
Amit Spadez8-Dec-09 23:06
professionalAmit Spadez8-Dec-09 23:06 
I have made login page...
And i'm taking the values from the 'tbLogin' table.
there are, for instance 5 entries in the table ...And i'm entering three entries out of 5...they are working fine but when I try to enter other two entries ....login form doesn't pick'em ..what could be the error ..plz help ..The coding for the login form is :



public partial class _Default : System.Web.UI.Page
{
SqlConnection con;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
ViewState["LoginErrors"] = 0;
}

if (validateFunction(Login1.UserName,Login1.Password))
{
Response.Redirect("gallery.aspx?Name=" + Login1.UserName);
}

}

protected void Login1_Authenticate(object sender,AuthenticateEventArgs e)
{
if (validateFunction(Login1.UserName, Login1.Password))
{
Session["UserName"] = Login1.UserName.ToString();
Login1.Visible = false;
Response.Redirect("gallery.aspx?Name=" + Login1.UserName);

}
else
{
e.Authenticated = false;
}

}

private bool validateFunction(string username, string password)
{
bool returnval = false;
string strConnection = "Server=.\\sqlexpress;Integrated Security=true;Initial Catalog=dbLogin";
con = new SqlConnection(strConnection);
String sqlQuery = "SELECT UserName, password FROM tbLogin WHERE UserName='" + username + "' and password='"+password + "'";
cmd = new SqlCommand(sqlQuery, con);
Session["UserName"] = Login1.UserName.ToString();
SqlDataReader dtr;
con.Open();
dtr = cmd.ExecuteReader();

while (dtr.Read())
{
if ((username == dtr["UserName"].ToString()) & (password == dtr["password"].ToString()))
{
returnval = true;

}
dtr.Close();
return returnval;
}
return returnval;
}

protected void login_error(object sender, EventArgs e)
{
if (ViewState["LoginErrors"] == null)
ViewState["LoginErrors"] = 0;
int errorcount = (int)ViewState["LoginErrors"] + 1;
ViewState["LoginErrors"] = errorcount;

if ((errorcount > 3) && (Login1.PasswordRecoveryUrl != string.Empty))
{
Response.Redirect(Login1.PasswordRecoveryUrl);
}
}






the table "tbLogin" columns are:
UserName,
Password
UserId


plz help in finding the error
AnswerRe: error in the login web page Pin
Blue_Boy8-Dec-09 23:34
Blue_Boy8-Dec-09 23:34 
GeneralRe: error in the login web page Pin
Amit Spadez9-Dec-09 0:10
professionalAmit Spadez9-Dec-09 0:10 
AnswerRe: error in the login web page Pin
Dinesh Mani9-Dec-09 0:36
Dinesh Mani9-Dec-09 0:36 
GeneralRe: error in the login web page Pin
Amit Spadez9-Dec-09 0:42
professionalAmit Spadez9-Dec-09 0:42 
GeneralRe: error in the login web page Pin
Dinesh Mani9-Dec-09 0:46
Dinesh Mani9-Dec-09 0:46 
GeneralRe: error in the login web page Pin
Amit Spadez9-Dec-09 0:49
professionalAmit Spadez9-Dec-09 0:49 
GeneralRe: error in the login web page Pin
Dinesh Mani9-Dec-09 0:52
Dinesh Mani9-Dec-09 0:52 
GeneralRe: error in the login web page Pin
Amit Spadez9-Dec-09 0:56
professionalAmit Spadez9-Dec-09 0:56 
GeneralRe: error in the login web page Pin
Dinesh Mani9-Dec-09 1:01
Dinesh Mani9-Dec-09 1:01 
GeneralRe: error in the login web page Pin
Amit Spadez9-Dec-09 1:19
professionalAmit Spadez9-Dec-09 1:19 
GeneralRe: error in the login web page Pin
Dinesh Mani9-Dec-09 1:20
Dinesh Mani9-Dec-09 1:20 
GeneralRe: error in the login web page Pin
Amit Spadez9-Dec-09 1:21
professionalAmit Spadez9-Dec-09 1:21 
GeneralRe: error in the login web page Pin
Dinesh Mani9-Dec-09 1:29
Dinesh Mani9-Dec-09 1:29 
GeneralRe: error in the login web page Pin
Amit Spadez9-Dec-09 1:53
professionalAmit Spadez9-Dec-09 1:53 
QuestionGet date from a calendar in TextBox of formview Pin
rummer8-Dec-09 22:39
rummer8-Dec-09 22:39 
QuestionHTML Editor Pin
Any_India8-Dec-09 21:28
Any_India8-Dec-09 21:28 
AnswerRe: HTML Editor Pin
Petr Pechovic8-Dec-09 21:35
professionalPetr Pechovic8-Dec-09 21:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.