Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ASP.NET中创建新用户后,User.Identity.Name不再保留当前登录用户的用户名?_Asp.net_Asp.net Membership_Identity - Fatal编程技术网

在ASP.NET中创建新用户后,User.Identity.Name不再保留当前登录用户的用户名?

在ASP.NET中创建新用户后,User.Identity.Name不再保留当前登录用户的用户名?,asp.net,asp.net-membership,identity,Asp.net,Asp.net Membership,Identity,我对asp.net会员课程很陌生。请原谅我问了这么一个根本性的问题。我做了一个简短的搜索,但没有找到答案,我的时间不多了 我正在使用LoginName、LogIn和CreateUSerWizard控件 除了我创建一个新用户之外,一切都正常。登录名立即更改为“显示我创建的新用户的名称”。我在登录时将User.Identity.Name存储在会话(“User”)中,因此我认为可以通过在CompleteWizard步骤的ActivateStep事件中将其设置为会话变量的值来更改User.Identit

我对asp.net会员课程很陌生。请原谅我问了这么一个根本性的问题。我做了一个简短的搜索,但没有找到答案,我的时间不多了

我正在使用LoginName、LogIn和CreateUSerWizard控件

除了我创建一个新用户之外,一切都正常。登录名立即更改为“显示我创建的新用户的名称”。我在登录时将User.Identity.Name存储在会话(“User”)中,因此我认为可以通过在CompleteWizard步骤的ActivateStep事件中将其设置为会话变量的值来更改User.Identity.Name的内容,但User.Identity.Name是只读的


创建新用户后,如何更改User.Identity.Name的内容或更改LogInName的内容

如果您正在使用
CreateUserWizard
创建新用户,则需要将设置为
false

谢谢Richard,它在应用不到5分钟的时间内就工作了。格雷西亚斯!