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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:59:14+00:00 2026-05-29T08:59:14+00:00

Well, this is an interesting problem. I have an ASP.NET MVC3 Intranet application running

  • 0

Well, this is an interesting problem. I have an ASP.NET MVC3 Intranet application running on the Visual Studio Development Server, no NTLM. I don’t have an AD domain on the machine I’m testing on.

When I try to user User.Identity.Name, it throws a null reference exception, however when I use Environment.UserDomain and Environment.UserName, they are populated with the correct values.

I’m seriously confused about this. Should I avoid using User.Identity.Name, or is there a reason why this is null?

UPDATE

I just noticed that when I use
System.Web.HttpContext.Current.User.Identity.Name it works, but just using User.Identity.Name doesn’t work. Am I missing a using statement?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
  • 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-29T08:59:15+00:00Added an answer on May 29, 2026 at 8:59 am

    Environment.UserName just tells the user who is currently running your program, in your case it’s the user who is running the development server I guess, doesn’t have to do anything with asp.net.

    User.Identity.Name is totally different… it tells you the name of the logged in person in the current context. And by the way you don’t have to have NTLM to use it… you can set up SqlMembershipProvider or a custom membership provider and use forms authentication and it will work fine without AD.

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

Sidebar

Related Questions

I am using ASP .NET MVC 3 and I have an interesting problem to
So this is an interesting problem. I have custom tableviewcells that include a text
I have a very interesting problem. I use this technologies in WPF app: Caliburn.Micro
I have an interesting (but frustraring) problem. I have an application which uses the
This is very interesting to me... This image displays perfectly well in Safari, but
I have previously read Spolsky's article on character-encoding, as well as this from dive
well i have this messages table with sample values like these: msg_id recipient_id read
Well I have this MySQL stored procedure that I wrote and if I run
This is more of an general architecture problem. If you have a cron job
I just found an interesting situation. Suppose you have some SwingWorker (I've made this

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.