Lifecycle question regarding master pages

Discussion in 'ASP .Net' started by =?Utf-8?B?ZHNvcnJlbGw=?=, Sep 13, 2007.

  1. I've been having a recurring issue with master page authentication. Right
    now, I have verification code in the Page_Init event of the master page,
    which checks the Page.User object to make sure the Membership object is still
    alive. If not, it redirects to the login page. If so, it lets the user see
    whatever page they were after. My issue is that it seems sometimes this event
    doesn't fire when it's supposed to, and I'll get "object refrence not set to
    an instance of an object" errors specifically on the call for the User object.

    Anybody know how to fix this problem?
     
    =?Utf-8?B?ZHNvcnJlbGw=?=, Sep 13, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?ZHNvcnJlbGw=?=

    bruce barker Guest

    the master page is a control on the actual page. this means its oninit
    fires when other page controls fire, not necessarily first.

    you validation code should probably be in BeginRequest in the
    application object.


    -- bruce (sqlwork.com)

    dsorrell wrote:
    > I've been having a recurring issue with master page authentication. Right
    > now, I have verification code in the Page_Init event of the master page,
    > which checks the Page.User object to make sure the Membership object is still
    > alive. If not, it redirects to the login page. If so, it lets the user see
    > whatever page they were after. My issue is that it seems sometimes this event
    > doesn't fire when it's supposed to, and I'll get "object refrence not set to
    > an instance of an object" errors specifically on the call for the User object.
    >
    > Anybody know how to fix this problem?
     
    bruce barker, Sep 13, 2007
    #2
    1. Advertising

  3. The problem with that is that there are three different areas that require
    different authentication... each area has its' own master page checking to
    make sure the user object is in the right group to be viewing that part of
    the website.

    "bruce barker" wrote:

    > the master page is a control on the actual page. this means its oninit
    > fires when other page controls fire, not necessarily first.
    >
    > you validation code should probably be in BeginRequest in the
    > application object.
    >
    >
    > -- bruce (sqlwork.com)
    >
    > dsorrell wrote:
    > > I've been having a recurring issue with master page authentication. Right
    > > now, I have verification code in the Page_Init event of the master page,
    > > which checks the Page.User object to make sure the Membership object is still
    > > alive. If not, it redirects to the login page. If so, it lets the user see
    > > whatever page they were after. My issue is that it seems sometimes this event
    > > doesn't fire when it's supposed to, and I'll get "object refrence not set to
    > > an instance of an object" errors specifically on the call for the User object.
    > >
    > > Anybody know how to fix this problem?

    >
     
    =?Utf-8?B?ZHNvcnJlbGw=?=, Sep 14, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Electrified Research
    Replies:
    5
    Views:
    2,483
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 11, 2005
  2. Doug McCann
    Replies:
    1
    Views:
    1,079
    William Brogden
    Aug 5, 2004
  3. Replies:
    1
    Views:
    3,251
    PeterKellner
    May 16, 2006
  4. =?Utf-8?B?bWdvbnphbGVzMw==?=

    Master Page lifecycle

    =?Utf-8?B?bWdvbnphbGVzMw==?=, Jul 5, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    779
    Teemu Keiski
    Jul 5, 2006
  5. =?Utf-8?B?bWdvbnphbGVzMw==?=

    Master Page Lifecycle (note)

    =?Utf-8?B?bWdvbnphbGVzMw==?=, Jul 5, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    310
    =?Utf-8?B?bWdvbnphbGVzMw==?=
    Jul 5, 2006
Loading...

Share This Page