I am developing a website for my project. In that project there are many web pages in the website. In that Some pages requires authentication to visit those pages. First they have to create their account or sign in their account.
In my login page when the user logins then he moves to a page called profile.aspx.
I am making verification on every page. After verification, if user is not logged in then user is redirect to login page. When he logins then after that he is transferred to a page called "Profile.aspx."
But i want user should redirect to that page from where he was forced to move to login page after verification.
This is my problem.
My Login_btn code is :-
protected void Login_btn_Click(object sender, EventArgs e)
{
login_mthd();
}
private void login_mthd()
{
string constr = (@"server = KANHA-PC; database=codeproject; integrated security=true;");
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand("select * from id_dtl where user_id='" + id_txtbx.Text + "' and passwrd='" + paswrd_txtbx.Text + "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
Session["user"] = id_txtbx.Text;
Response.Redirect("profile.aspx");
}
else
{
invalid_usr_lbl.Visible = true;
}
}
But in my application i want him to move directly on the page what he wants to see instead of "profile.aspx".am making verification on every page. After verification if user is redirect to login page. When he logins then after that he is transferred to a page called "Profile.aspx."
But i want user should redirect to that page from where he was forced to move to login page after verification.
This is my problem.
I am not using inbuild login tools of Visual Studio 2008.
How to create this function.
Thanx in advance
Rakesh Sharma