Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6048337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:27:07+00:00 2026-05-23T07:27:07+00:00

Master Page : <ul> <li class=first><asp:HyperLink runat=server ID=lnkHome NavigateUrl=~/Forms/Default.aspx>Home</asp:HyperLink></li> <asp:Repeater runat=server ID=Repeater1 DataSourceID=SiteMapDataSource1 EnableViewState=False>

  • 0

Master Page:

<ul>
    <li class="first"><asp:HyperLink runat="server" ID="lnkHome" 
        NavigateUrl="~/Forms/Default.aspx">Home</asp:HyperLink></li>

    <asp:Repeater runat="server" ID="Repeater1" DataSourceID="SiteMapDataSource1" 
        EnableViewState="False">
        <ItemTemplate>
            <li>
                <asp:HyperLink ID="HyperLink1" runat="server" 
                    NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %>
                </asp:HyperLink>
            </li>
        </ItemTemplate>
    </asp:Repeater>
</ul>

Web.SiteMap

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >

  <siteMapNode id="SiteHome" url="~/Forms/Default.aspx" title="Home"  
        description="Default">
      <siteMapNode id="SiteAbout" url="~/Forms/Aboutus.aspx" title="About us"  
            description="About Us"/>
      <siteMapNode id="SiteNew" url="~/Forms/New.aspx" title="New"  
            description="My Sample Page"/>    
 </siteMapNode>

Design:

HOME | About us | My Sample Page


I am new on ASP.Net Webforms and i am creating my first Project.
I am using Repeater to navigate page urls.
On my Master/Page.cs Code Behind I need to Hide
[My Sample Page] based on my Login Account.

something like:

if(UserGroup="Admin")
{
  //Show My Sample Page
  HOME | About us | My Sample Page 
}
else if(UserGroup="User1") 

{
//Hide About Us
HOME | About us
}
else
{
// Show Home Only
HOME
}

How to do it in form Load?
Thanks in Regards..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:27:07+00:00Added an answer on May 23, 2026 at 7:27 am

    The correct way to do this is define a site map provider in your Web.Config and make sure you set the attribute securityTrimmingEnabled="true".

    <siteMap defaultProvider="MySiteMap">
     <providers>
       <clear/>
       <add 
         name="MySiteMap"
         type="System.Web.XmlSiteMapProvider" 
         securityTrimmingEnabled="true" 
         siteMapFile="~/Web.SiteMap" />
     </providers>
    </siteMap>
    

    In your Forms folder create a Web.Config file and include the following

    <?xml version="1.0"?>
    <configuration>
      <system.web>
        <authorization>
          <allow users="*" />
        </authorization>
      </system.web>
      <location path="New.aspx">
        <system.web>
          <authorization>       
            <deny users="?" />
          </authorization>
        </system.web>
      </location>
    </configuration>
    

    Now ASP.Net will take care of showing which parts of your site map to which users.
    Eg: In this case it will hide your My Sample Page page from un-authenticated users.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a master page that contains an ASP.NET server side Menu control (System.Web.UI.WebControls.Menu)
Source First: Default.aspx: <%@ Page Language=C# AutoEventWireup=true CodeBehind=Default.aspx.cs Inherits=WebApplication2.Default %> <!DOCTYPE html PUBLIC -//W3C//DTD
Consider this Asp.net page code: <head runat=server> <title></title> <script type=text/javascript> function showhide(master, detail) {
I wanted to set a CSS class in my master page, which depends on
In the following master.cs code: public partial class Default : System.Web.UI.MasterPage { protected void
If the Master Page and child aspx page are in different folders, when the
In a Master page, I have this.... <ul id=productList> <li id=product_a class=active> <a href=>Product
I have a master page called SampleMaster.master and this page contains a Repeater control
OK, being a server developer, this Javascript voodoo on the ASP.NET page (based on
I have a site.master page in an asp application which contains a div menu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.