Finding the account name

  • Thread starter Thread starter mavrick_101
  • Start date Start date
M

mavrick_101

Hi,

How can I find out or Response.write the name of the account underwhich my
application is running (eg impersonating account etc)

Thnx
 
Thanks.

Patrice said:
Try :
http://www.eggheadcafe.com/articles/20050703.asp
depending on what exactly you are after (seems you are looking for
WindowsIdentity ?)

(Response.Write is a thing of the past, in ASP.NET you generally construct a
control tree that is then rendered, you don't render directly HTML code to
the browse as it would be out of place).

--
Patrice

"mavrick_101" <[email protected]> a crit dans le message
de groupe de discussion :
(e-mail address removed)...
 
re:"
!> How can I find out the name of the account underwhich my
!> application is running (eg impersonating account etc)

Use this :

<%@ Page Language="VB" %>
<%@ Import NameSpace = System.Security.Principal %>
<script runat="server">
Sub Page_Load()
Dim tmp As String = WindowsIdentity.GetCurrent.Name()
Label1.Text = "ASP.NET is running as the account : " & tmp
End Sub
</script>
<html>
<head>
<title>What account is ASP.NET running as ?</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
=========================
 
Back
Top