Click here to Skip to main content
15,884,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Authorized member only view details of my site. If member click a log out button means they have to be redirected to home page(Home.aspx). This is works correctly. Again member want to view the particular means they can access a page.. So this s my error.. can only help me, how to clear the session??


C#
if (IsPostBack == false)
           {
               if (Session["log"] != null)
               {
                   if (Session["log"].ToString() == "s")
                   {
                      //function()
                   }
                   else
                   {
                       Response.Redirect("UserLogin.aspx", false);
                   }
               }
               else
               {
                   Response.Redirect("UserLogin.aspx", false);
               }
           }
Posted

try to use this.
C#
session.clear();
session.abandon();
 
Share this answer
 
For clearing the session values, you can use the following

C#
session.clear();
session.abandon();


and on page load check the value of the
C#
if(session["uid"]==null)
{
//redirect page
}


Thanks
 
Share this answer
 
Comments
AshishChaudha 1-Jan-13 0:42am    
Accepted and downvoted !!! :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900