简体   繁体   中英

getting windows username instead of logged in user name in asp .net web form 4.5

Web Config:

<authentication mode="Forms">
  <forms loginUrl="/Public/Login.aspx" protection="All" timeout="30" name=".ASPXAUTH" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="default.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false"/>
</authentication>

Loggin Code:

if (userLoginResults.UserLoginStatus == UserLoginStatus.Successful)
        {
            var email = UserName.Text.ToLower().Trim();

            if (userLoginResults.Contains(UserRoleNames.Admin))
            {
                FormsAuthentication.RedirectFromLoginPage(email, RememberMe.Checked);
                Session["isMemberLoggedIn"] = true;
                Response.Redirect("~/AdminPanel/Default.aspx");
            }

}

// var email = User.Identity.Name;

I did login by admin@admin.com but i am getting DESKTOP-OPT261T\\mobasshir. this is my windows username.. How can i solve this?

I am using windows 10. microsoft visual studio professional 2013

Thanks all

在此处输入图片说明 I have fixed it by disable the windows authentication... i did it by clicking on webproject from visual studio and then pressed f4 then windows authentication to disbled

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM