开发者

C# How to login as a different user programmatically into a NTAuthenticated Website

开发者 https://www.devze.com 2023-01-08 17:58 出处:网络
Our team uses a website that uses NT Authentication. I need to point my automation scripts to that site.

Our team uses a website that uses NT Authentication. I need to point my automation scripts to that site. This n开发者_运维技巧eeds passing the credentials of the testuser accounts to the application and not mine.

How do I do that programmatically so that the application won't prompt for the credentials.

Alternatively, can somebody suggest a way to handle the windows security prompt so that I can enter the username and password there and then?

thx


You will want to impersonate in your calling C# app, then connect to the site with integrated windows auth.

Here is a tutorial on how to impersonate from a C# app to make a remote call: http://www.codeproject.com/KB/cs/cpimpersonation1.aspx


What you need is called HttpWebRequest. Look at this answer, previously posted on SO: Login to the page with HttpWebRequest

0

精彩评论

暂无评论...
验证码 换一张
取 消