Home All Groups Group Topic Archive Search About

Disabling certain url's in a menu?

Author
29 Apr 2006 5:56 PM
kfrost
Hello,

I have a menu bound to a SiteMapDataSource which reads from my web.sitemap.

I'm using the menu in a master page and everything works fine but I need to
some of the menu items to be disabled depending on the user who is accessing
the web page.

For example I have a menu as with the follow nodes.
Freight
     Add
     Search

Certain users will only search and I want to disable the Add item.  Anybody
have any ideas as to how to go about doing this?

Thanks.

kris
--
k***@n-sv.com.<Remove This Before Emailing>

Network & Software Integration
www.n-sv.com

"Helping put the pieces of your IT puzzle together"

Author
29 Apr 2006 6:13 PM
Teemu Keiski
Hi,

site map can be applied security settings based on in which role users is.
It is called security trimming.

See: http://msdn2.microsoft.com/en-US/library/ms178428.aspx


--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

Show quoteHide quote
"kfrost" <k***@n-sv.com.(donotspam)> wrote in message
news:F003BC6B-3A78-4365-87BA-272F67DE4840@microsoft.com...
> Hello,
>
> I have a menu bound to a SiteMapDataSource which reads from my
> web.sitemap.
>
> I'm using the menu in a master page and everything works fine but I need
> to
> some of the menu items to be disabled depending on the user who is
> accessing
> the web page.
>
> For example I have a menu as with the follow nodes.
> Freight
>     Add
>     Search
>
> Certain users will only search and I want to disable the Add item.
> Anybody
> have any ideas as to how to go about doing this?
>
> Thanks.
>
> kris
> --
> k***@n-sv.com.<Remove This Before Emailing>
>
> Network & Software Integration
> www.n-sv.com
>
> "Helping put the pieces of your IT puzzle together"
Author
29 Apr 2006 6:58 PM
kfrost
Hmm, walked through that and I guess it's ok if you want to spend the time to
hassle through it.  Also, I'm not going to define ASP.Net Roles.  This is an
intranet application and we're using security groups to control access.

To verify authorization we use User.IsInRole("Domain\username");

I stilled try following the direction in the link you sent but with
roles="*" on the urls, adding the settings to the web.config blocks the
entire menu.  So I assume you have to enable roles which I'm not interested
in doing at this point to try and do something this simple.

So isn't there a simple way to find the menuitem or node in the datasource
and disable just disable it when the page loads?

thanks.

--
k***@n-sv.com.<Remove This Before Emailing>

Network & Software Integration
www.n-sv.com

"Helping put the pieces of your IT puzzle together"


Show quoteHide quote
"Teemu Keiski" wrote:

> Hi,
>
> site map can be applied security settings based on in which role users is.
> It is called security trimming.
>
> See: http://msdn2.microsoft.com/en-US/library/ms178428.aspx
>
>
> --
> Teemu Keiski
> ASP.NET MVP, AspInsider
> Finland, EU
> http://blogs.aspadvice.com/joteke
>
> "kfrost" <k***@n-sv.com.(donotspam)> wrote in message
> news:F003BC6B-3A78-4365-87BA-272F67DE4840@microsoft.com...
> > Hello,
> >
> > I have a menu bound to a SiteMapDataSource which reads from my
> > web.sitemap.
> >
> > I'm using the menu in a master page and everything works fine but I need
> > to
> > some of the menu items to be disabled depending on the user who is
> > accessing
> > the web page.
> >
> > For example I have a menu as with the follow nodes.
> > Freight
> >     Add
> >     Search
> >
> > Certain users will only search and I want to disable the Add item.
> > Anybody
> > have any ideas as to how to go about doing this?
> >
> > Thanks.
> >
> > kris
> > --
> > k***@n-sv.com.<Remove This Before Emailing>
> >
> > Network & Software Integration
> > www.n-sv.com
> >
> > "Helping put the pieces of your IT puzzle together"
>
>
>
Author
29 Apr 2006 7:03 PM
kfrost
P.S.  To enable roles in ASP.Net 2.0, don't you need to have sqlexpress
installed on the server?  I'm not sure if the .Net 2.0 framework installs sql
express by default but sqlexpress will not be running on this server.

Again, haven't spent that much time with roles and don't really care to in
this project.

So that puts me back to the original question and is there a way to disable
a menu item or hide it programmatically when it's populated from a
web.sitemap file?

Thanks.
Author
30 Apr 2006 7:41 AM
Teemu Keiski
It would create a local database into App_Data folder.

Yes, if programmatical approach is needed, you certainly can have control
via SiteMap object

For example:

SiteMap.CurrentNode.ReadOnly = True

Here is more about SiteMap:
http://msdn2.microsoft.com/en-us/library/system.web.sitemap(VS.80).aspx

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


Show quoteHide quote
"kfrost" <k***@n-sv.com.(donotspam)> wrote in message
news:A10B8C73-6A1A-4F67-B94A-ED8C5470F04A@microsoft.com...
> P.S.  To enable roles in ASP.Net 2.0, don't you need to have sqlexpress
> installed on the server?  I'm not sure if the .Net 2.0 framework installs
> sql
> express by default but sqlexpress will not be running on this server.
>
> Again, haven't spent that much time with roles and don't really care to in
> this project.
>
> So that puts me back to the original question and is there a way to
> disable
> a menu item or hide it programmatically when it's populated from a
> web.sitemap file?
>
> Thanks.
>
>
>