0
、私はUser.Identity.Nameスローオブジェクト参照がインスタンスに設定されていない
Anonymous Authentication : Disabled
Windows Authentication : Enabled
を持っていると私は
Object reference not set to an instance
を取得しています私は、IISの開発設定では、このコード
public UserProfile spUserProfileGet()
{
// this line throw : Object reference not set to an instance
var user = HttpContext.Current.User.Identity.Name;
//...
}
を持っています
なぜですか?これまで多くのプロジェクトで問題なくこのクラスを使用しています:/
HttpContext.Current.User
はNULL
ですが、どうしてですか?
[NullReferenceExceptionとは何ですか?それを修正するにはどうすればいいですか?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix -it) – DavidG
はい、UserオブジェクトはNULLですが、なぜですか? – Muflix
重複した質問を読むと、それを正確に把握する方法がわかります。 – DavidG