0

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?

1 Answer 1

2
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>
Sign up to request clarification or add additional context in comments.

4 Comments

Then i give the username myself but i want to get the same name as the name they use to login.
I hope the article in this link will help you @Urjen
U are a hero, that was EXACTLY where i was searching for. My google skills failed me again apperently.
@Urjen Glad to help you. Please mark as answer if that solved your problem. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.