1

hii

how can i implement logout feature on my page so that user is redirected to a new page and is not allowed to view previous page.

2

4 Answers 4

3
  if (SessionConfig.Current.UserType != null)
        Response.Redirect("~/Logout.aspx?UserType=" + SessionConfig.Current.UserType,false);
    else
        Response.Redirect("~/Default.aspx",false);

where sessionconfig is a session variable already declared.

 public static SessionConfig Current
        {
            get
            {
                SessionConfig session =
                  (SessionConfig)HttpContext.Current.Session["__SessionConfig__"];
                if (session == null)
                {
                    session = new SessionConfig();
                    HttpContext.Current.Session["__SessionConfig__"] = session;
                }
                return session;
            }
        }

Just put this in button click event and change to your home page in homepage.aspx . It will redirect the page and you cannot see the old page

Sign up to request clarification or add additional context in comments.

1 Comment

where do I declare the SessionConfig variable
1

Just add LogoutAction="RedirectToLoginPage" to the login control and it will solve your problem.

Hope this helps

Comments

0

take a look at ASP.net Login Controls
if you want the user to not be allowed to back to the previous page see this topic

Comments

0

First of all, enable asp.net security permissions and set anonymous users access as Denied. then, use asp.net log-in control and set it up as you wish...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.