未配置匿名登录 userIdentity 不应为空

问题描述

public void GetUserInfo(out IIdentity userIdentity,out IntPtr userId) {

        if (HttpContext.Current != null
              && HttpContext.Current.User != null)
        {
            userIdentity = HttpContext.Current.User.Identity;
          
        }
        else
        {
         
         throw new NullReferenceException("Anonymous logon is not configured. 
          userIdentity should not be null!");
        }

        // initialize a pointer to the current user id to zero
        userId = IntPtr.Zero;
    }

HttpContext.Current.User.Identity 即将为空。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)