WebControl setting security

Discussion in 'ASP .Net Web Controls' started by STech, Oct 7, 2004.

  1. STech

    STech Guest

    Hi,

    I have several aspx pages (user.aspx, admin.aspx...) that contains one
    common user control (foo.ascx). Foo.ascx is responsible for checking the
    roles of the user logged on and display data based on role. If a person with
    only "user" access tries to access, say, admin.aspx, I want to redirect the
    user to user.aspx. The problem is that, in this case, the aspx page loads
    first before the foo.ascx loads.

    Is there a way to force a method in foo.ascx to fire first before the aspx
    page is loaded? This way I can redirect the user before the page competes
    loading.

    Thanks.
    STech, Oct 7, 2004
    #1
    1. Advertising

  2. Hi Stech,

    As for the Control/Page Load sequence problem you mentioned, it is the
    normal behavior of the asp.net web form page. Since all the sub controls
    are created after the page init and also the Page's Load event fire first
    and then recursively call's the sub control's Load, we can't change this
    sequence manually. As for checking roles. Is the role you mentioned the
    custom roles defined in you web application? Generally , we can use
    HttpModule or the Global object's Applicatoin level events to perform such
    checking , those event fire event before the page is construct, you may try
    doing the check there, here are some tech articles discussing on such means:

    #Custom Authentication provider by implementing IHttpModule, IPrincipal and
    IIdentity
    http://www.codeproject.com/aspnet/AspNetCustomAuth.asp

    #Role-Based Authorization With Forms Authentication
    http://aspnet.4guysfromrolla.com/articles/082703-1.aspx

    http://www.codeproject.com/aspnet/formsroleauth.asp

    Hope helps. Thanks.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    Steven Cheng[MSFT], Oct 19, 2004
    #2
    1. Advertising

  3. Hi Stech,

    Have you had a chance to check the suggestions in my last reply or have you
    got any further progress on this issue? If there're anything else we can
    help, please feel free to post here.
    Thanks.


    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    Steven Cheng[MSFT], Oct 25, 2004
    #3
  4. STech

    STech Guest

    The explanation works for me. Thanks.


    "Steven Cheng[MSFT]" wrote:

    > Hi Stech,
    >
    > Have you had a chance to check the suggestions in my last reply or have you
    > got any further progress on this issue? If there're anything else we can
    > help, please feel free to post here.
    > Thanks.
    >
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Support
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    >
    STech, Oct 26, 2004
    #4
  5. You're welcome, Stech.

    Thanks again for your posting. Have a good day!

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    Steven Cheng[MSFT], Oct 27, 2004
    #5
    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. Guest
    Replies:
    2
    Views:
    724
  2. Luis Ramírez.

    Can a webcontrol (webcontrol.dll) have a configuration file?

    Luis Ramírez., Jul 5, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    185
    Luis Ramírez
    Jul 6, 2004
  3. Kasabaarde Sumta

    WebControl inside of WebControl and attaching events

    Kasabaarde Sumta, Dec 13, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    177
    Kasabaarde Sumta
    Dec 13, 2004
  4. Fabricio

    Custom webcontrol that references another webcontrol

    Fabricio, Sep 21, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    170
    Fabricio
    Sep 21, 2005
  5. Peter Morris [Air Software Ltd]

    WebControl with non-WebControl property

    Peter Morris [Air Software Ltd], Dec 7, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    126
    Peter Morris [Air Software Ltd]
    Dec 7, 2004
Loading...

Share This Page