Configure webcontrol properties through Web.Config?

Discussion in 'ASP .Net Web Controls' started by Haris, Oct 5, 2006.

  1. Haris

    Haris Guest

    Is it possible to configure webcontrol properties through Web.Config and
    also to combine these with autorisation?

    It would look something like this:

    <location path="Admin">
    <system.web>
    <form id="newUser">
    <control id="userRank">
    <authorization>
    <allow roles="administrator"/>
    <deny users="*"/>
    </authorization>
    </control>
    </form>
    </system.web>
    </location>


    This would mean that only if a user has role of "administrator" he would
    be able to see the control "userRank" in the form "newUser"





    TIA
    Haris
     
    Haris, Oct 5, 2006
    #1
    1. Advertising

  2. Look at the Login controls.

    http://msdn2.microsoft.com/en-us/library/ms178329.aspx

    You may find the Login View control does part of what you want.
    Otherwise, you can set the Visible property on any control based on
    whether or not a user is in a role or not. To do that you need the
    Membership and Role providers enabled.

    You can see my configurations here...

    http://brennan.offwhite.net/blog/2006/09/25/multiple-site-authentication-with-aspnet-20/
    http://brennan.offwhite.net/blog/2006/09/25/robust-custom-profiles/


    Brennan Stehling
    http://brennan.offwhite.net/blog/


    Haris wrote:
    > Is it possible to configure webcontrol properties through Web.Config and
    > also to combine these with autorisation?
    >
    > It would look something like this:
    >
    > <location path="Admin">
    > <system.web>
    > <form id="newUser">
    > <control id="userRank">
    > <authorization>
    > <allow roles="administrator"/>
    > <deny users="*"/>
    > </authorization>
    > </control>
    > </form>
    > </system.web>
    > </location>
    >
    >
    > This would mean that only if a user has role of "administrator" he would
    > be able to see the control "userRank" in the form "newUser"
    >
    >
    >
    >
    >
    > TIA
    > Haris
     
    Brennan Stehling, Oct 6, 2006
    #2
    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:
    755
  2. Kevin Hsu

    configure font.properties

    Kevin Hsu, Feb 25, 2004, in forum: Java
    Replies:
    1
    Views:
    476
  3. HS1
    Replies:
    0
    Views:
    480
  4. CSharpner
    Replies:
    0
    Views:
    1,133
    CSharpner
    Apr 9, 2007
  5. 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:
    218
    Luis Ramírez
    Jul 6, 2004
Loading...

Share This Page