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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:30:24+00:00 2026-05-17T02:30:24+00:00

When a user log into my asp.net site I use the following code: FormsAuthentication.RedirectFromLoginPage(userid,

  • 0

When a user log into my asp.net site I use the following code:

FormsAuthentication.RedirectFromLoginPage(userid, false);

As I often need to use the userid I can then later get the userid by:

string userid = System.Web.HttpContext.Current.User.Identity.Name;

Now I also want to show the logged in username on each page and my questions is therefore where do I place the username best if I need to use it on every page. User.Identity.Name is already taken by the userid so I can’t use that one. Another solution would be to get the username from the database on each page, but that seems like a bad solution.

So: Is the best way to use Sessions to store the username?

  • 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-17T02:30:24+00:00Added an answer on May 17, 2026 at 2:30 am

    You can store just about anything in SessionState in asp.net. Just be careful and store the right things in the right places (you can also use ViewState to store variables.

    Check this out for how to use SessionState to store and retrieve variables across postbacks.

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

Sidebar

Related Questions

I am running into an issue with logging into an ASP.NET MVC web site
I have a asp.net mvc web site where I make use of the Dependency
I've got a web app I'm building in ASP.NET that has the following security
I have a site which is built in ASP.net and C#. Let's call it
I am currently converting a very old, but working classic ASP site to ASP.Net.
I'm building an ASP.NET MVC 2 site where I'm currently implementing an OpenID sign-up
I'm working on a project where I need the following. WCF service on the
I am connecting to a SQL Server database via LINQ in my ASP.NET application
I'm working on an application that has similar logic as SO with regards to
This problem has been solved thanks to your suggestions. See the bottom for details.

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.