I want to capture the user opening my page in an internal Windows AD network.
I think I've tried everything:
@{
// other code
string user123 = HttpContext.Current.User.Identity;
}
and also
@{
// other code
<script>
var user123 = HttpContext.Current.User.Identity;
</script>
}
And trying to use that later inside my HTML code. Or passing it as a parameter to a stored procedure inside my razor block.
Nothing. Either empty, runtime error, or undefined.
Note1: HttpContext
is recognized by WebMatrix as an element.
Note2: I enabled Windows Authentication in the server.
Note3: My head is spinning from this.
Note4: I'm a total rookie, as I'm just getting started with this.
Note5: I tried Page.Current...
but it doesn't recognize the Page
element.