Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. loginstatus control-sessions

loginstatus control-sessions

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-net
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MalarGayu
    wrote on last edited by
    #1

    hi friends i am developing an asp.net project in c#. In a master page i have a loginstatus control on the click of the control i have written: protected void LoginStatus_LoggingOut(object sender, LoginCancelEventArgs e) { Session["UserId"] = ""; Session.Abandon(); Response.Redirect("../Login.aspx"); } which redirects to the login page but from that page, if i type an aspx page in the site information tab where we used to type the webaddress it takes me to the page by the person name who just logged out can anyone help me in this issue. K.Gayathri

    L U C T 4 Replies Last reply
    0
    • M MalarGayu

      hi friends i am developing an asp.net project in c#. In a master page i have a loginstatus control on the click of the control i have written: protected void LoginStatus_LoggingOut(object sender, LoginCancelEventArgs e) { Session["UserId"] = ""; Session.Abandon(); Response.Redirect("../Login.aspx"); } which redirects to the login page but from that page, if i type an aspx page in the site information tab where we used to type the webaddress it takes me to the page by the person name who just logged out can anyone help me in this issue. K.Gayathri

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Hi Gayathri, Please give Session.Clear(); Session.Abandon(); Session.RemoveAll(); Respons.Redirect("Test.aspx"); This will clear ur session used. Guhananth.S

      1 Reply Last reply
      0
      • M MalarGayu

        hi friends i am developing an asp.net project in c#. In a master page i have a loginstatus control on the click of the control i have written: protected void LoginStatus_LoggingOut(object sender, LoginCancelEventArgs e) { Session["UserId"] = ""; Session.Abandon(); Response.Redirect("../Login.aspx"); } which redirects to the login page but from that page, if i type an aspx page in the site information tab where we used to type the webaddress it takes me to the page by the person name who just logged out can anyone help me in this issue. K.Gayathri

        U Offline
        U Offline
        uspatel
        wrote on last edited by
        #3

        try these lines on page load of every restricted page

        if (Session["UserId"]==null)
        {
        Response.Redirect("Login.aspx");
        }

        and try

        Session["UserId"] = null;
        Session.Abandon();
        Response.Redirect("../Login.aspx");

        1 Reply Last reply
        0
        • M MalarGayu

          hi friends i am developing an asp.net project in c#. In a master page i have a loginstatus control on the click of the control i have written: protected void LoginStatus_LoggingOut(object sender, LoginCancelEventArgs e) { Session["UserId"] = ""; Session.Abandon(); Response.Redirect("../Login.aspx"); } which redirects to the login page but from that page, if i type an aspx page in the site information tab where we used to type the webaddress it takes me to the page by the person name who just logged out can anyone help me in this issue. K.Gayathri

          C Offline
          C Offline
          coded007
          wrote on last edited by
          #4

          MalarGayu wrote:

          protected void LoginStatus_LoggingOut(object sender, LoginCancelEventArgs e)
                      {
                            Session["UserId"] = "";
                            Session.Abandon();
                            Response.Redirect("../Login.aspx");
           
                      }

          There is no need of

          MalarGayu wrote:

          Session["UserId"] = "";

          You can directly use

          MalarGayu wrote:

          Session.Abandon();

          it will clear all variables of session and more over please use

          Server.Transfer("");

          inseted of

          Response.Redirect("")

          M 1 Reply Last reply
          0
          • C coded007

            MalarGayu wrote:

            protected void LoginStatus_LoggingOut(object sender, LoginCancelEventArgs e)
                        {
                              Session["UserId"] = "";
                              Session.Abandon();
                              Response.Redirect("../Login.aspx");
             
                        }

            There is no need of

            MalarGayu wrote:

            Session["UserId"] = "";

            You can directly use

            MalarGayu wrote:

            Session.Abandon();

            it will clear all variables of session and more over please use

            Server.Transfer("");

            inseted of

            Response.Redirect("")

            M Offline
            M Offline
            MalarGayu
            wrote on last edited by
            #5

            hi friends thanks for all your replies i tried: protected void LoginStatus_LoggingOut(object sender, LoginCancelEventArgs e) { Session["UserId"] = ""; Session.Abandon(); Response.Redirect("../Login.aspx"); } it is redirecting but after i got to login.aspx and on the page i type another aspx page it is getting into that page with the last persons login id.... i dont want that to happen so how to do it K.Gayathri

            1 Reply Last reply
            0
            • M MalarGayu

              hi friends i am developing an asp.net project in c#. In a master page i have a loginstatus control on the click of the control i have written: protected void LoginStatus_LoggingOut(object sender, LoginCancelEventArgs e) { Session["UserId"] = ""; Session.Abandon(); Response.Redirect("../Login.aspx"); } which redirects to the login page but from that page, if i type an aspx page in the site information tab where we used to type the webaddress it takes me to the page by the person name who just logged out can anyone help me in this issue. K.Gayathri

              T Offline
              T Offline
              thatraja
              wrote on last edited by
              #6

              Check this Tip/Trick(It contains clear explanation about all things) Browser back button issue after logout[^]

              thatraja


              My Dad had a Heart Attack on this day so don't...
              Pompeyboy3 here
              | Nobody remains a virgin, Life screws everyone :sigh:

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups