index > Team Foundation Server - General > TeamFoundationServer.EnsureAuthenticated() appears to hang in ASP...

TeamFoundationServer.EnsureAuthenticated() appears to hang in ASP...


I have the following code in the code-behind C# file of an ASP.NET application:

TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(m_strTeamSystemServer, new UICredentialsProvider();


tfs.EnsureAuthenticated();

Works fine when in my development environment inside the Visual Studio solution. Well, the connection to tfs works anyway. I don't get prompted for credentials.

The problem is when I copy the website to my deployment environment. When tfs.EnsureAuthenticated(); is called, the site just "hangs". It sits there in a loading state (this code is called in my Page_Load) forever, or at least until I got tired of waiting (5 minutes or so).

Any ideas what could be the problem here? Why don't I get a credentials dialog? I checked to make sure there was no popup blocker or anything running, and I see other javascript alert() dialogs without any issue.

Rob

Rob Davis

Oh, I also tried using the TeamFoundationServer constructor instead of the TeamFoundationServerFactory and it made no difference.

Rob

Rob Davis
Rob, EnsureAuthenticated will raise a winforms popup, but not designed to raise popups in web scenarios. I guess what you want is the webservice to use target user's credentials. If that is the case, you can turn on impersonation. If you want user to enter userid/password, then you need to build a form and pass NetworkCredential object with that info. For both options and samples, check out http://blogs.msdn.com/narend/archive/2006/07/29/682032.aspx .


http://blogs.msdn.com/narend
Naren Datha - MSFT

If you are going to use the code in an ASP.NET site, do not specify a UICredentialsProvider to either the factory or the constructor. When you call EnsureAuthenticated() in that case, it will throw TeamFoundationServerUnauthorizedException if the current credentials fail to authenticate with the server. If you need to specify a particular set of credentials, you can supply them to the constructor.

The following may help: TFS API: How to choose between TeamFoundationServerFactory.GetServer() and the TeamFoundationServer constructor.

Buck




http://blogs.msdn.com/buckh
Buck Hodges

I finally resorted to just creating my own (very redundant) login form and create the credentials based on the user's input. I tried to get impersonation to work, but I got nothing from the DefaultNetworkCredentials object regardless of what my impersonation settings were. I got the expected login prompt when first loading the web site, but the DefaultNetworkCredentials remained blank. Anyway, it works well enough using my own login form, but it's definitely not my preferred design.

Rob

Rob Davis
reply 5

You can use google to search for other answers

 

More Articles

What is the purpose of the standard categories of checkin notes?
Create a team instance outside of the Vis Studio
No data in LatestWorkItemRev_Fact in BisDWDB Database
Customing Team Build / MSBuild
TFS Source code folder
Error connecting to Team Server
Question about authentication through VPN??
Changsets in the build process
Team Build Install Issue
Creating workitem with blank <REASON> in <TRANSITION>...
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

source explorer : repository organization
Issue for printing out work item
Path Space Branching and Builds?
Bug in tf merges?
How to accomodate multiple products with…
Problems with Branching
Setting the "Team Build Service&quo…
Opening an Excel Document from Sharepoin…
How to allow negative input
Team Build and MSBuild order
Lost version control mapping in Team Exp…
Maintain Process Guidance through Proces…
Do the source control features of TFS Be…
Cloaking question
How to hook build engine to get sources …

Hot Articles

how to costumize checkout policies (cost…
To Merge or a not to Merge
Report using project name
Installation Problems
Best Practices for SCM
TFS Beta 3 Installation - Sharepoint not…
new install
Web Deployment Project -> Team Build
Publishing Test Results
Team project and Source Control issues
Information on BVT
Bug: Get Latest Changes causes VS.Net to…
History details on initial changeset is …
Get Latest Project1, Build Project1, Get…
Articles on how to work with TFS

Recommend Articles

Re: 3 of 4 project alerts works
Project Standard versus Project Pro
Bug Reports in RC not working
Project Creation Wizard Didn't Find Repo…
GCHandle exception when using work item …
Error: "Build machine cant be conta…
How to delete a Build Type?
WorkItems with "dependencies"...
recommended scripting tools
Harvest vs. Visual Studio Team Foundation
TFS/Project Integration
TFS SP1 ?
Error encountered when adding a solution…
Work Item Internal Database Format
Shortcut to "Go to Work Item"