2 Replies - 744 Views - Last Post: 24 April 2018 - 07:28 AM Rate Topic: -----

#1 gussy81   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 175
  • Joined: 24-February 15

session

Posted 09 April 2018 - 07:43 AM

hi guys,

looking for some insight on sessions.

I have setup a login page(based on talking to login table in my database) and I can also log the user out.

Session setup:
if (count==1)
                {
                    Session["username"] = txtUsername.Text.Trim();
                    Response.Redirect("Dashboard.aspx");
                    
                }








This is my code for loggin out:
        protected void btnLogout_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            Response.Redirect("Login.aspx");
        }



my question is do I need to set this up on each page to abandon the session or is there a simpler way to deal with a session on all of my pages?

Thanks
G

Is This A Good Question/Topic? 0
  • +

Replies To: session

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14691
  • View blog
  • Posts: 58,719
  • Joined: 12-June 08

Re: session

Posted 24 April 2018 - 07:25 AM

Depends on what's going on.. if this is older webforms, even older still 'master pages', the new fancy Razor/Core2.0 pages, etc.

I guess sort of depends on how you are doing your toolbar in the page.
Was This Post Helpful? 0
  • +
  • -

#3 gussy81   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 175
  • Joined: 24-February 15

Re: session

Posted 24 April 2018 - 07:28 AM

hi modi,

i think i found a solution. i inserted the session into a section on the Master page and thus solving my problem.

thanks
G
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1