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

  • SEARCH
  • Home
  • 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 8836039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:24:02+00:00 2026-06-14T09:24:02+00:00

In an ASP.NEt MVC application, how is it possible to display some conditional data

  • 0

In an ASP.NEt MVC application, how is it possible to display some conditional data to a layout page?

My application allows a user with a role of “Admin” to view the other user’s pages and data from the same application. When the Admin views the pages of another user he/she needs to see the information of the user like his name/role/etc whose data he/she is viewing ( this information comes from the DB) . This info needs to be shown in all the pages when an Admin User is logged in and ONLY when an ADmin is logged in. i.e, if a user who is not Admin enters these details should not be shown as it is not relevant.

The issue iam facing in my attempts is that the Admin user does not login to the user’s page, instead I have to achieve this feature of switching to the users view by clicking on a list/grid of users. This takes me to the home page of the user (and i get the inforamtion displayed since i set it in viwbag) .Question is, how do i set this value in the subsequent user pages of this session. Trying to avoid filling this viewbag value in every controller/action.

Please help!

PS: The information that needs to be displayed in the layout is based on the user’s ID that the Admin selects from the grid. It commes from the DB.

  • 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-14T09:24:03+00:00Added an answer on June 14, 2026 at 9:24 am

    You could write the user id to a cookie and use a action filter to check for this cookie on requests done by the admin user

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

Sidebar

Related Questions

In an ASP.Net MVC 1.0 applicati0n, is it possible to access the application settings
I am doing an asp.net mvc application having a Data Access Layer (DAL). Having
I am developing an asp.net mvc application where user1 could delete data records which
In my ASP.NET MVC application, I'm trying to figure out whether the user has
I am creating a asp.net mvc application and loaded the data into jqgrid and
In my ASP.NET MVC 2 application I use HandleErrorAttribute to display a custom error
In an asp.net MVC application, is it possible to reference views from a class
Possible Duplicate: How to use multiple view engines in ASP.NET MVC application I am
First some background, I am currently working on a relatively large Asp.Net MVC application
I'm using NHibernate to load some objects into my ASP.NET MVC application. For example,

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.