How to load test a web page using Windows authentication

跟風遠走 提交于 2019-12-11 10:45:26

问题


I'm in the process of developing some load tests for an internal web application.

The problem appears to be related to our use of Windows authentication. I can access the web application if I launch the browser and nevigate to our app. I can't, however, access the application via webrequest in my load test. It throws a 401 exception, Unauthorized.

I'm using Visual Studio 2010 Ultimate.

How do I use my Windows credentials in my load test? Any other ideas?


回答1:


Select The Test Main node, and click the red marked button to set credentials




回答2:


If your load testing tool doesn't have a way to specify the credentials to run under, you will have to use Windows Impersonation (just to perform your tests).

You could potentially do this in code (see here: http://www.codeproject.com/KB/cs/cpimpersonation1.aspx), but if you don't need to get fancy, it will be easier to update your web.config with the credentials to run under:

<identity impersonate="true" userName="accountname" password="password" />

This should work for any pages under the web site for which the web.config is configured.




回答3:


I found this works...

 request.Credentials = System.Net.CredentialCache.DefaultCredentials;


来源:https://stackoverflow.com/questions/4190758/how-to-load-test-a-web-page-using-windows-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!