Retrieving an ICredentials Object for an Authenticated ASP Website User

I am trying to add a function to an existing ASP.net website that is supposed to pull user calendar data from an Exchange web service. I know that this is possible, and I have local tests working as proof of concept, but I am having some problems implementing this in the context of the ASP website.

My intention is to override the default credentials by building an instance of the WebCredentials class using the current user account credentials for ASP sites and then using this to create the Exchange service binding.

Example

ExchangeService service = new ExchangeService(ExchnageVersion.2007);
service.AutoDetect(emailAddress);
service.Credentials = new WebCredentials(credentials);

Unfortunately, a WebCredentials object can only be created from a set of strings containing a username, password, and domain, or by passing an ICredentials object.

So, the question is, on the forms authenticated website, is there a way to get the ICredentials object for the current authenticated user?

+3
source share
1 answer

Formless authentication uses an encrypted custom cookie, which is sent by the browser with each request. This allows ASP.NET to know that the user is authenticated and who they are. It is not designed to work with external systems, and in fact, it requires that the machine key on the server can decrypt the details. Transferring credentials to another server would be pointless.

Windows auth, , , , NTLM Kerberos HTTP Exchange.

, ICredentials, Windows ASP.Net, /, NetworkCrententials.

+3

All Articles