Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6692999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:55:56+00:00 2026-05-26T05:55:56+00:00

Got a Site.Master (Masterpage) Got Default.aspx (Page) And in the Default.aspx , there is

  • 0
  • Got a Site.Master (Masterpage)
  • Got Default.aspx (Page)
  • And in the Default.aspx, there is a UserControl LoginUserControl.ascx placed

Now my problem:

In the LoginUserControl I check if Login is right.
If yes, then I set the Property IsLoggedIn on the Default.aspx to true:

    //Inside LoginUserControl.ascx
    if (/*Login is Ok*/)
    {
         ((Default)Page).IsLoggedIn = true;
    }

So, now I need this Information in my Masterpage Site.Master
I must know if User is logged in or not.. I do this:

    //Inside Site.Master
    protected void Page_Load(object sender, EventArgs e)
    {
        if (((Default)Page).IsLoggedIn)
        {
             //Do Something
        } 
    }

But its ALWAYS false! Why? I thought I set the IsLoggedIn = true ?! Why is it then false? Is it a Lifecycle problem and what I must do, that it works 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:55:56+00:00Added an answer on May 26, 2026 at 5:55 am

    You should add the property IsLogged on to the viewstate of the page.

    public bool IsLoggedOn { 
        get { return ViewState["IsLoggedOn"]==null?false:Convert.ToBoolean(ViewState["IsLoggedOn"]); }
        set { ViewState["IsLoggedOn"] = value; }
    }
    

    Or if the property is used over multiple pages you should add it to the Session (replace ViewState with Session)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a ASP.NET webforms site with some inline code on a master page
Working on the Loginmechanism... But got problems.. I have a UserControl ( LoginUserControl.ascx )
I got a asp site hosted in a iis server. In the server there
I've got a web site sending someone a confirmation email. Now in the email
I’m using Heather Solomon’s minimal publishing master page, I’ve got a simple feature with
I've got master.kid (simplified): <html> <head py:match=item.tag == 'head'> <title>My Site</title> </head> <body py:match=item.tag
With the way my site is setup, I have a master page, page and
Got this site with UN/PW set via the Createuserwizard control. Client considers PW too
I've got a site that provides blog-friendly widgets via JavaScript. These work fine in
i've got a site with a lot of referenced .js-Files; those are rather small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.