Re: Authentication and user based content

Discussion in 'ASP .Net' started by Eliyahu Goldin, Apr 14, 2008.

  1. You can use different sitemaps for different roles.

    If you have 2 providers in the web.config

    <siteMap enabled="true">
    <providers>
    <add name="Role1SiteMapProvider" description="SiteMap for role 1."
    type="System.Web.XmlSiteMapProvider"
    siteMapFile="Roles/Role1/Role1.sitemap" />
    <add name="Role2SiteMapProvider" description="SiteMap for role 2."
    type="System.Web.XmlSiteMapProvider"
    siteMapFile="Roles/Role2/Role2.sitemap" />
    </providers>
    </siteMap>

    you can set SiteMapProvider property for navigation controls in the code to
    either Role1SiteMapProvider or Role2SiteMapProvider depending on the user
    role.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "John Devlon" <> wrote in message
    news:...
    > Hi,
    >
    > I've created a small application with some user-authentication and roles.
    >
    > I would like to show/hide some navigation parts based on the users role.
    >
    > Could someone please tell me what the best solution is?
    >
    > Do I have to create different pages for each role and check the users
    > role when logged in?
    >
    > Thanx
    >
    > Kind regards
    >
    > John
    >
     
    Eliyahu Goldin, Apr 14, 2008
    #1
    1. Advertising

  2. Eliyahu Goldin

    John Devlon Guest

    Thanx for your respons....

    However, I think it's not something I can use...

    I've created a navigation system with pictures and placed them in a
    table....
    Only some rows have to be shown with each role...

    Can I show/hide elements like tables and pictures depending on the role?

    Thanx

    John





    "Eliyahu Goldin" <> schreef in
    bericht news:...
    > You can use different sitemaps for different roles.
    >
    > If you have 2 providers in the web.config
    >
    > <siteMap enabled="true">
    > <providers>
    > <add name="Role1SiteMapProvider" description="SiteMap for role 1."
    > type="System.Web.XmlSiteMapProvider"
    > siteMapFile="Roles/Role1/Role1.sitemap" />
    > <add name="Role2SiteMapProvider" description="SiteMap for role 2."
    > type="System.Web.XmlSiteMapProvider"
    > siteMapFile="Roles/Role2/Role2.sitemap" />
    > </providers>
    > </siteMap>
    >
    > you can set SiteMapProvider property for navigation controls in the code
    > to either Role1SiteMapProvider or Role2SiteMapProvider depending on the
    > user role.
    >
    > --
    > Eliyahu Goldin,
    > Software Developer
    > Microsoft MVP [ASP.NET]
    > http://msmvps.com/blogs/egoldin
    > http://usableasp.net
    >
    >
    > "John Devlon" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> I've created a small application with some user-authentication and roles.
    >>
    >> I would like to show/hide some navigation parts based on the users role.
    >>
    >> Could someone please tell me what the best solution is?
    >>
    >> Do I have to create different pages for each role and check the users
    >> role when logged in?
    >>
    >> Thanx
    >>
    >> Kind regards
    >>
    >> John
    >>

    >
    >
     
    John Devlon, Apr 14, 2008
    #2
    1. Advertising

  3. You can always check what is the role for the current user and set visual
    properties for your controls accordingly.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "John Devlon" <> wrote in message
    news:8jKMj.23578$2...
    > Thanx for your respons....
    >
    > However, I think it's not something I can use...
    >
    > I've created a navigation system with pictures and placed them in a
    > table....
    > Only some rows have to be shown with each role...
    >
    > Can I show/hide elements like tables and pictures depending on the role?
    >
    > Thanx
    >
    > John
    >
    >
    >
    >
    >
    > "Eliyahu Goldin" <> schreef in
    > bericht news:...
    >> You can use different sitemaps for different roles.
    >>
    >> If you have 2 providers in the web.config
    >>
    >> <siteMap enabled="true">
    >> <providers>
    >> <add name="Role1SiteMapProvider" description="SiteMap for role 1."
    >> type="System.Web.XmlSiteMapProvider"
    >> siteMapFile="Roles/Role1/Role1.sitemap" />
    >> <add name="Role2SiteMapProvider" description="SiteMap for role 2."
    >> type="System.Web.XmlSiteMapProvider"
    >> siteMapFile="Roles/Role2/Role2.sitemap" />
    >> </providers>
    >> </siteMap>
    >>
    >> you can set SiteMapProvider property for navigation controls in the code
    >> to either Role1SiteMapProvider or Role2SiteMapProvider depending on the
    >> user role.
    >>
    >> --
    >> Eliyahu Goldin,
    >> Software Developer
    >> Microsoft MVP [ASP.NET]
    >> http://msmvps.com/blogs/egoldin
    >> http://usableasp.net
    >>
    >>
    >> "John Devlon" <> wrote in message
    >> news:...
    >>> Hi,
    >>>
    >>> I've created a small application with some user-authentication and
    >>> roles.
    >>>
    >>> I would like to show/hide some navigation parts based on the users role.
    >>>
    >>> Could someone please tell me what the best solution is?
    >>>
    >>> Do I have to create different pages for each role and check the users
    >>> role when logged in?
    >>>
    >>> Thanx
    >>>
    >>> Kind regards
    >>>
    >>> John
    >>>

    >>
    >>

    >
    >
     
    Eliyahu Goldin, Apr 14, 2008
    #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.

Share This Page