DataServicePackageRepository Authentication

Jan 10, 2012 at 12:42 AM


I have a web page with an action like this:

ActionResult TestFeed(Uri feedUri, string username, string password)

I can't figure out the right way to pass credentials to the DataServicePackageRepository within that action. 

The repository has a SendingRequest event, but it isn't raised in time (it looks like RedirectedHttpClient makes a request before raising), so I can't use that to set the credentials. 

It looks like the only solution is to use a custom ICredentialProvider and assign it to HttpClient.DefaultCredentialProvider, but that's static - two attempts to use it at the same time is probably going to break something, and that's quite possible if this is an MVC action used by multiple users. 

Are there any alternatives?