How do I tell who my ASP.NET app is running as?

D

David Thielen

I am getting this error - but I don't know what user to give rights to this
directory too - and I think the user that needs it - has it.

[UnauthorizedAccessException: Access to the path
'C:\WINDOWS\System32\LogFiles\WindwardPortal\PortalAudit.xml' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
+2014243
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access,
Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize,
FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean
bFromProxy) +998
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share) +114
net.windward.portal.audit.Auditor.CreateFile() in
C:\src\RePortal\WindwardPortalEngine\net\windward\portal\audit\Auditor.cs:258
net.windward.portal.audit.Auditor..cctor() in
C:\src\RePortal\WindwardPortalEngine\net\windward\portal\audit\Auditor.cs:140

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
L

Luke Zhang [MSFT]

Hello Dave,

You can try following code to make what is the account:

Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name);

Also, to trouble shoot such a file access security issue, you may trace the
file access with tool named Filemo, it can log all Read/Wrtie activity to
local file system and report if any errors like "Access Denied". For more
information on it:

http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/Filemon.ms
px


Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
L

Luke Zhang [MSFT]

To do this, you may query the IIS application and application pool with
WMI, and then check the application pool's identity property. Following
articles may give you some hints on this:

http://msdn2.microsoft.com/en-us/library/ms525309.aspx
http://todotnet.com/archive/2005/08/06/1559.aspx

However, this may be not a complete answer for this question: Suppose the
ASP.NET sets impersonate to true, the current code will be executed with
current log user's permission, not the identity of application pool. So, we
can only actually know the user account after the ASP.NET app is running.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
L

Luke Zhang [MSFT]

Anyway, we won't get so much pay for coding if back to the DOS generation :)

Sincerely,

Luke Zhang

Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no rights.
 
L

Luke Zhang [MSFT]

Hello Dave,

The default account for an application pool in IIS is "Network service".

Sincerely,

Luke Zhang

Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top