?
Solved

Not sure if this is a good question but thought I'll ask..

Posted on 2006-05-05
5
Medium Priority
?
168 Views
Last Modified: 2012-05-05
I've develop a VB.NET application that we now want to move to the web.  And, I am amazed on the restriction of the web development in ASP.NET.  

Actually, I am using the Website Navagation.  And using web.sitemap.  It appears a really nice feature with the web.config and all.  However, I was thinking if I have someone log in.  I would like the webcontrol.menu to show differently based on who signs in.

For example, I want the Administrator to see following links in the menu:

Admin | Employees | Managers | Guests

And, the Employees to see:

Employees | Guests

And managers to see:

Employees | Managers | Guests

And the Guests will only see:

Guests

Is there a way I could manage the menu based on who signed in?  

Any suggestions on how to do it or what to do?

Thank you,

SLC Tech
0
Comment
Question by:SLCTech
  • 3
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
TornadoV earned 500 total points
ID: 16617109
You can put the following in your web.config:

<location path="admin.aspx">
   <system.web>
         <authorization>
      <allow roles="admins"/>
      <deny users="*"/>
         </authorization>
   </system.web>
</location>

<location path="employees.aspx">
   <system.web>
         <authorization>
      <allow roles="admin,managers,employees"/>
      <deny users="*"/>
         </authorization>
   </system.web>
</location>

etc.

Basically you can restrict access to the specific page(s) by modifying web.config sections and specifying roles that are allowed to have access.
0
 

Author Comment

by:SLCTech
ID: 16630291
Are you saying there is no way the web.sitemap can control the webcontrol.menu from inside the page to have a navagation based on the roles?  I do not want to create so many pages just to modify the navagation of the site.

SLC Tech
0
 
LVL 11

Expert Comment

by:TornadoV
ID: 16630580
No, I am not saying that, on a contrary web.sitemap controls any/all navigation controls on the page if it is selected as their datasource.

If web.sitemap is a datasource for your menu control and you have applied access rules then all authenticated users will only see links based on their roles.  I don't think you would want just to hide links from the menu; you might also want to restrict access to the pages that hidden links are pointing to.  If you simply remove a link to your 'admin.aspx' from navigation menu it will not stop a 'Guest' user from simply typing the URL in the address bar.
0
 
LVL 11

Expert Comment

by:TornadoV
ID: 16630794
Are you trying to implement Site-Map Security Trimming?  Here is a good article: http://msdn2.microsoft.com/en-US/library/ms178429.aspx
0
 

Author Comment

by:SLCTech
ID: 16631040
Wow your right.  I didn't see that one till I ran the script.

Thank you very much.

SLC Tech
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Integration Management Part 2
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question