Need to Impersonate user forAccessing Network resource, Asp.Net Account

前端 未结 5 1875
别那么骄傲
别那么骄傲 2020-12-10 20:55

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\" exce

5条回答
  •  北海茫月
    2020-12-10 21:32

    I've only had intimate experience with this under 1.1, so things might hav changed in the 2.0 days but... We've got an app that gets deployed in intranet scenarios, and we strike the same thing. We run with identity impersonate turned on, forms mode authentication, anonymous access turned off. The easiest way to control this (that I've found) is to put the credentials of the user that has access in the web.config. They go on the node where you turn identity impersonate on. If it's super scret info I wouldn't do it this way though! We're only accessing shared graphics in a print environment, so most sites are happy to setup a limited account for us to put in the web.confit. LogonUser does indeed need elevated privelidges. Msdn has some good articles on how to impersonate a specific user in code. I'd fish out some links but this phone doesn't do copy paste.

提交回复
热议问题