How do you determine the process identifier for ASP.NET? I get UnAthorizedAccessExeption when a user clicks on a LinkButton link 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 performing this process: Environment.UserName
For the person requesting the page: Page.User.Identity
Edit: A network service is the default account used to serve content over a network (such as IIS). View all built-in accounts . You will need to grant network access to the folder (providing all other websites that also use this account access) or set up another account.
Are you using IIS 6 or 7?
I assume that you want to get the process ID when the ASPX page runs. In this case:
System.Security.Principal.WindowsIdentity.GetCurrent().Name;
What you need to do is put
<identity impersonate="true" username="x" password="x" />
in your web.config that has permissions to delete the file.
To find all executable processes, you can use System.Diagnostics.Process.GetProcesses() .
System.Diagnostics.Process.GetProcesses()
For more information about this, please check the URL :http://www.itpian.com/Coding/4588-How-to-find-the-active-processes-in-Windows.aspx
URL
thanks