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 7811879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:19:33+00:00 2026-06-02T04:19:33+00:00

I am using Asp.Net/C# to build an application.I am using Forms Authentication .I have

  • 0

I am using Asp.Net/C# to build an application.I am using Forms Authentication.I have a requirement such that many of my authenticated (not anonymous) users are restricted to certain page functionalities or user interface.I guess the Login Control could be used for only Authenticated vs Anonymous users.So my question is when I know that certain page component is to be hidden from particular authenticated users , how do I go about it.Do you think I need to use this on the page_load event to hide the components for the pages which have such requirements.

// Is this Tito visiting the page?
string userName = User.Identity.Name;
if (string.Compare(userName, "Tito", true) == 0)
 // This is Tito, SHOW the Delete column
 FilesGrid.Columns[1].Visible = true;
else
 // This is NOT Tito, HIDE the Delete column
 FilesGrid.Columns[1].Visible = false;

Are there better approaches to accomplish this.Any help is much appreciated.Thanks

  • 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-06-02T04:19:36+00:00Added an answer on June 2, 2026 at 4:19 am

    Here you can use the Membeship User class and RolePrincipal to separate the users.

    if(HttpContext.Current.User.IsInRole("Level1"))
    {
        FilesGrid.Columns[1].Visible = true;
    }
    else
    {
        FilesGrid.Columns[1].Visible = false;
    }
    

    So you make and place your user in different membership names, and then you show them different controls that are depend on the membership role.

    Some links:

    http://msdn.microsoft.com/en-us/library/ff648345.aspx

    http://msdn.microsoft.com/en-us/library/system.web.security.roleprincipal.isinrole.aspx

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

Sidebar

Related Questions

I have a web application built in asp.net mvc using forms authentication. I am
I've built an ASP.NET application that's using Forms Authentication. In our hosting account control
In my asp.net webforms application I am using plain and simple forms authentication hooked
I am using ASP.NET MVC to build my application. I have a treeview (with
I have an ASP.Net 4.0 web forms application that is ignoring any changes I
I am going to build my application using asp.net mvc3 and nhibernate 3.2. I
I am working on big application build using ASP.NET which was started 1.5 years
I am using Asp.Net/C# and Visual Studio 2008 to build an application.Right now I
I am trying to build an iPhone web application using ASP.NET. The page is
I have build a webapplication using ASP.NET MVC and JQuery. On my local machine

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.