Finding the account name

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
 
M

mavrick_101

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)...
 
J

Juan T. Llibre

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/
=========================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,240
Latest member
pashute

Latest Threads

Top