需要模拟用户forAccessing网络资源,Asp.Net账户 [英] Need to Impersonate user forAccessing Network resource, Asp.Net Account

查看:147
本文介绍了需要模拟用户forAccessing网络资源,Asp.Net账户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要访问它只是一个给定的域帐户可以访问的网络资源。 我现在用的是LogonUser的电话,却得到了一个用户没有要求priviliege例外,因为Web应用程序与asp.net帐户下运行,并没有足够的权限,使这个电话。

I need to access a network resource on which only a given Domain Account has access. I am using the LogonUser call, but get a "User does not have required priviliege" exception, as the web application is running with the asp.net account and it does not have adequate permissions to make this call.

有没有办法来解决呢? 更改ASP.Net帐户的身份或权限,是不是一种选择,因为这是一个生产机器有许多项目正在运行。 有没有更好的方式来实现这一目标?

Is there a way to get around it? Changing the identity or permissions of the ASP.Net account is not an option as this is a production machine with many projects running. Is there a better way to achieve this?

使用Asp.Net 2.0,窗体身份验证。

Using Asp.Net 2.0, Forms Authentication.

亲切的问候。

推荐答案

只是调用LogonUser的是不够的。您需要模拟该用户。你也可以模拟为只访问网络资源。

Just calling LogonUser is not enough. You need to impersonate that user. You can impersonate for just the access to the network resource.

样品code可以在 MSDN 被发现。

Sample code can be found on MSDN.

这篇关于需要模拟用户forAccessing网络资源,Asp.Net账户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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