Newbie
Newbie

Reputation: 361

connect to tfs with current logged in windows user

I am trying to connect to tfs in a mvc application. I want to connect with the logged in windows user credentials. I tried something like

var tfsCredentials = new TfsClientCredentials(new WindowsCredential(), true);
            TfsTeamProjectCollection teamCollection = new TfsTeamProjectCollection(new Uri("http://tfssite.com/tfs/" + Collection), tfsCredentials);

this doesnt return any user when i debug and always get the information based on the app pool user identity.

I also enabled windows authentication in web.config but nothing seems working.

Appreciate any help.

Thanks, GT

Upvotes: 2

Views: 1363

Answers (1)

michalh
michalh

Reputation: 2997

This way

TfsTeamProjectCollection teamCollection = new TfsTeamProjectCollection(
  new Uri("http://tfssite.com/tfs/" + Collection),
  System.Net.CredentialCache.DefaultNetworkCredentials);

Upvotes: 3

Related Questions