How do I call an MVC Action via a WebRequest and validate the request through Active Directory?

后端 未结 1 935
长情又很酷
长情又很酷 2021-01-16 08:31

I know the title is a mouthful. I\'ve got most things in place already. I just need confirmation on if I can do what I\'m attempting.

I\'m using ASP.NET MVC 3. I hav

相关标签:
1条回答
  • 2021-01-16 08:44

    Two thoughts:

    1) You could try forcing impersonation before you make your WebRequest call. Like this:

    var impersonationContext = ((WindowsIdentity)User.Identity).Impersonate();
    //Make your WebRequest call here...
    impersonationContext.Undo();
    

    2) You could pass the user in the WebRequest call, in the service side get the user identity from AD, then use a variation of the above code to impersonate them.

    Here is a link that talks more about the impersonation code used above: http://msdn.microsoft.com/en-us/library/w070t6ka.aspx

    0 讨论(0)
提交回复
热议问题