How do you determine the process identity for ASP.NET? I am getting an UnAthorizedAccessExeption when a user clicks a LinkButton designed to use System.IO to delete a file located in a subfolder of the root folder for a Web Application Project in Visual Studio 2008.
For the user running the process: Environment.UserName
For the person requesting the page: Page.User.Identity
Edit: Network Service is the default account used for serving content across the network (e.g. IIS). See all built-in accounts. You'll have to give Network Service access to the folder (giving all your other websites that use this account access as well) or set up another account.
Are you using IIS 6 or 7?
I'm assuming you want to obtain the process identity within the execution of the ASPX page. In that case:
System.Security.Principal.WindowsIdentity.GetCurrent().Name;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With