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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:09:10+00:00 2026-06-09T03:09:10+00:00

I am creating a web application using ASP.NET MVC 4. I want to display

  • 0

I am creating a web application using ASP.NET MVC 4.

I want to display the user’s nickname on all of pages, so I have to load it in _layout.cshtml.

Please note that I’m storing user’s nickname manually. (In my own database and my own tables.)

I can add user’s User name by Membership.GetUser().UserName, but I want to load his nickname from database and show it in _layout.cshtml.

How to do that?

  • 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-09T03:09:13+00:00Added an answer on June 9, 2026 at 3:09 am

    I would advise you to upon logging in, store the username in a session variable (which is done by accessing the Session object, which implements a key=value pair architecture allowing you to store and retrieve your data at will). It’s a drag on performance to have to make a database call for EVERY page that loads, and a single nickname string variable in session won’t take up that much space on your server.

    As far as loading the variable you could use the code posted by Vahid, but I would recommend you if your site is still in its infancy to take the extra time to learn and implement Entity Framework. It is cleaner, easier and Microsoft is really pushing data connection management in that direction.

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

Sidebar

Related Questions

I'm creating a web application using ASP.NET MVC 4 and C#. I want all
I am creating a Web application using ASP.NET MVC, and I'm trying to use
I'm currently creating an application using ASP.NET MVC. I got some user input inside
I am creating a Web Application using ASP.NET MVC 3 and I would like
I'm creating a web application using spring mvc. I have started to incorporate the
I am creating a web application in ASP.net/VB.NET and I have an issue with
I am creating a web application using ASP.Net. I am using session in my
I'm creating a web application using asp.net & WCF as 3 tier architecture, which
I'm creating an ASP.NET MVC application using F# on IIS 7. When I attempt
I am creating a new web application using ASP.NET MVC3 Razor and HTML 5.

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.