How to set login authentication?
Hi i m Developing asp.net web application.i want to set log in authentication...if i have logged in,, then only i could access other pages..otherwise it should run log in page only... how do i set..can anyone help me out...

Sanjeeb LenkaPosted Aug 13, 2013, 5:40 AM
you can try like this:
in successfull login store the username in session. then every page in page load check the session is having value or not, if it having value then show the page if not redirect to loginpage:
ex:
in login page on successfull login :
Session["UserID"]=textbox.Text;
in other pages in pageload:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserID"] == null || (Session["UserID"] != null && Convert.ToString(Session["UserID"]) == String.Empty))
Response.Redirect("login.aspx");
else
{
//your code in page load
}
}
Nermin HuskicPosted Aug 23, 2013, 6:03 AM
Nermin HuskicPosted Aug 23, 2013, 6:01 AM
protected void Prijava_Click(object sender, EventArgs e)
Rohit SharmaPosted Aug 22, 2013, 11:55 PM
you mean to say i put
in my login click event. when i put it then it will be given an error .
give me an example please.i am very thankful to you.
Nermin HuskicPosted Aug 22, 2013, 5:35 AM
Rohit SharmaPosted Aug 22, 2013, 3:02 AM
You are write but i am facing on problem when i apply this
my design page is not working. when i remove
then i get my design.
so how can i solve it.
Nermin HuskicPosted Aug 13, 2013, 6:52 AM
This meens that, anyone can access your login Page, and other pages can be accessed only logged users. Beacuse this code
It is good to make Folders in your solution and restrict access by putting new web config with new authorization rules. If you want to grant access to all users just put
Sanjeeb LenkaPosted Aug 13, 2013, 6:14 AM
selva kumarPosted Aug 13, 2013, 6:11 AM