hii,
i m facing problem in logout code in asp.net c#.
please give the code which can do:-
1) session end
2) when pressing back button after logout it should be redirect to login page.
3)by pasting url of somebody's account in address bar it should not enter in the account and redirect to login page.

please provide code for both "session" and "authentication" method.
thank you for your time..

hi...,
it is very common problem...
u can use
session destroy, session time out method ,
nd make session null......

hi...,
it is very common problem...
u can use
session destroy, session time out method ,
nd make session null......

i already did this, but after logging out when i press back button it redirects to user's account page again..pls help

i already did this, but after logging out when i press back button it redirects to user's account page again..pls help

overwrite the value of particular session,
and load the page again,
and check you should filling all data of particular user at page load event.

Hai,

you can use the following Code

In Logout Button Click Event

 protected void btnlogout_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            Session.Clear();
            Response.Redirect("LoginPage.aspx");
        }

Am facing problem on jscript function that can show a div on button click.
pls smbody help me?

For this you can do following :

Check in each page load event if session is active or not!!!
If session is not active then redirect to login page.

And on click event of Logout button destroy/Clear session variable's value.

This will fulfill all your conditions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.