开发者

ASP.NET - How do you find the process identity?

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 sub开发者_StackOverflowfolder 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;


What you're going to need to do is put an

<identity impersonate="true" username="x" password="x" />

tag in your web.config that has rights to delete the file.


To find all executing processes u can use System.Diagnostics.Process.GetProcesses().

For more information on this please check this URL:
http://www.itpian.com/Coding/4588-How-to-find-the-active-processes-in-Windows.aspx

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜