将ASP.NET用户名存储为C#变量 [英] Store ASP.NET user name as C# variable

查看:54
本文介绍了将ASP.NET用户名存储为C#变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS 2012.



我正在使用默认的asp.net网络注册。





我想在文本框中输入用户的电子邮件地址。



类似这样的事情



txtEmail.Text =

<%:Context.User.Identity.GetUserName()%>  





我尝试了什么: < br $>


txtEmail.Text =<%:Context.User.Identity.GetUserName()%>

解决方案

< blockquote>如果您正在使用会员资格;



Membership.GetUser Method(String)(System.Web.Security) [ ^ ]



如果没有,那么你需要解释你用于身份验证的内容。


谢谢。这就是我要找的:

 User.Identity.Name.ToString()


I am using VS 2012.

I am using the default asp.net web registration.


I want to get the user email address as in a textbox.

something like this

txtEmail.Text =

<%: Context.User.Identity.GetUserName()  %>



What I have tried:

txtEmail.Text = <%: Context.User.Identity.GetUserName() %>

解决方案

If you're using Membership;

Membership.GetUser Method (String) (System.Web.Security)[^]

If not then you'll need to explain what you are using for authentication.


Thanks. That is what I was looking for:

User.Identity.Name.ToString()


这篇关于将ASP.NET用户名存储为C#变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆