简体   繁体   中英

asp.net authentication looks at machine name

I built a web app a while back that is miss behaving out of the blue. Page.User.Identity.Name returns the machine name ie phil_toshiba/phil instead of the username i set when the user logs in through the log in form (should be an email address):

System.Web.Security.FormsAuthentication.RedirectFromLoginPage(tb_email.Text, true);

I dont know why it has only just started doing it but it doesn't do it on the live site just the local project i need to work with to update some features. the live and local are in sync (code is exactly the same) only difference is the live site is compiled and using iis.

EDIT this is the authentication tag in my web.config file:

<authentication mode="Forms"  >
  <forms loginUrl="Default.aspx" name=".ASPXFORMSAUTH" defaultUrl="Sections.aspx">
  </forms>
</authentication>

Check your web.config, it should be set to use Forms authentication not Windows :

<system.web>
    <authentication mode="Forms"/>
</system.web>

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