如何找出哪个帐户我的ASP.NET code下运行? [英] How to find out which account my ASP.NET code is running under?

查看:145
本文介绍了如何找出哪个帐户我的ASP.NET code下运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到的路径访问在调试模式下运行时被拒绝的错误消息。我试图将权限授予{} MACHINENAME \\ ASPNET和网络服务,但这并没有作出任何区别。我也有试图与LT;?冒充= TRUE />使用管理员帐户,这也没有什么区别那么,如何建立究竟哪个帐户正在使用

I am getting an 'Access to the path is denied" error message when running in debug mode. I have tried granting permissions to {MACHINENAME}\ASPNET and to NETWORK SERVICE but this hasn't made any difference. I have also tried < impersonate = true /> using an admin account, this also made no difference. So how do I establish exactly which account is being used?

推荐答案

要找出NT帐户您的应用程序在任何给定时间运行的,做这样的事情(在VB.NET):

To find out which NT account your app is running under at any given time, do something like (in VB.NET):

    Dim User = System.Security.Principal.WindowsIdentity.GetCurrent.User
    Dim UserName = User.Translate(GetType(System.Security.Principal.NTAccount)).Value

在使用ASP.NET,这个帐户将匹配应用程序池,您配置使用IIS管理器的身份。需要注意的是IIS匿名用户没有太大的参与ASP.NET请求。

When using ASP.NET, this account will match the identity of the application pool, which you configure using IIS Manager. Note that the anonymous IIS user isn't much involved with ASP.NET requests.

这篇关于如何找出哪个帐户我的ASP.NET code下运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆