如何判断VB.Net应用程序正在运行的用户以及如何更改它?

时间:2022-01-24 04:14:54

We have an app that needs to access network resources. It's written in VB.Net. The application can't access the files on another server via a UNC path. How can we find out what user the application is truly running as and how can it be changed? We tried this KB from Microsoft... but it didn't work.

我们有一个需要访问网络资源的应用。它是用VB.Net编写的。应用程序无法通过UNC路径访问其他服务器上的文件。我们如何才能找出应用程序真正运行的用户以及如何更改?我们从微软尝试了这个KB ...但它没有用。

1 个解决方案

#1


If you want the logged in user's credentials here is the property to access:

如果您希望此处登录用户的凭据是要访问的属性:

Page.User.Identity.Name

If the app is running in an Application Pool, there is probably some account that it is set up to impersonate for its execution, e.g. local System account, Network Service or other. Task Manager under Processes can show a User Name for the worker process,e.g. aspnet_wp.exe on XP in IIS 5.1.

如果应用程序在应用程序池中运行,则可能有一些帐户被设置为模拟其执行,例如,本地系统帐户,网络服务或其他。进程下的任务管理器可以显示工作进程的用户名,例如。 IIS 5.1中的XP上的aspnet_wp.exe。

If neither of these help, state what version of IIS you are using and what version of VB.Net is being used to help narrow down what is happening.

如果这些都没有帮助,请说明您正在使用的IIS版本以及正在使用的VB.Net版本来帮助缩小正在发生的情况。

#1


If you want the logged in user's credentials here is the property to access:

如果您希望此处登录用户的凭据是要访问的属性:

Page.User.Identity.Name

If the app is running in an Application Pool, there is probably some account that it is set up to impersonate for its execution, e.g. local System account, Network Service or other. Task Manager under Processes can show a User Name for the worker process,e.g. aspnet_wp.exe on XP in IIS 5.1.

如果应用程序在应用程序池中运行,则可能有一些帐户被设置为模拟其执行,例如,本地系统帐户,网络服务或其他。进程下的任务管理器可以显示工作进程的用户名,例如。 IIS 5.1中的XP上的aspnet_wp.exe。

If neither of these help, state what version of IIS you are using and what version of VB.Net is being used to help narrow down what is happening.

如果这些都没有帮助,请说明您正在使用的IIS版本以及正在使用的VB.Net版本来帮助缩小正在发生的情况。