I am building a website using ASP.net and C#. For users to get on my website they need to authenticate themselves with windows authentication.
I am now trying to store the name where the user authenticates itself with in a session so i can use it later on in my website.
Does anyone knows how to do that?
Session["UserName"] = value;
Then you can retreive it like that:
string username = (string)Session["UserName"];
OR
<script type="text/javascript">
var someSession = '<%= Session["UserName"].ToString() %>';
</script>
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.