How to load test a web page using Windows authenti

2019-07-31 03:58发布

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?

3条回答
我欲成王,谁敢阻挡
2楼-- · 2019-07-31 04:33

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楼-- · 2019-07-31 04:48

I found this works...

 request.Credentials = System.Net.CredentialCache.DefaultCredentials;
查看更多
疯言疯语
4楼-- · 2019-07-31 04:50

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

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

查看更多
登录 后发表回答