Home All Groups Group Topic Archive Search About

Configure webcontrol properties through Web.Config?

Author
5 Oct 2006 5:17 PM
Haris
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

Author
6 Oct 2006 5:35 AM
Brennan Stehling
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:
Show quoteHide quote
> 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