Is it possible to connect to Exchange through Aspose.Email, using the impersonated users login?
Hi Darren,
The link provided is for Exchange impersonation. I’m asking about using ASP.NET Impersonation, and getting the ASP.NET users email. More precisely, through Active Directory Delegation.
Hi Darren,
Hi,
Hi Darren,
It is to brief you on the ticket logged earlier as NETWORKNET-33352.
I am sure you are already aware of ASP.NET Impersonation concept. To compare it with Aspose.Email for .NET component, I am providing these details. ASP.NET Impersonation is a feature of Microsoft .NET which provides the ability to control the identity under which code is executed. In general, ASP.NET Impersonation allows to retrieve required credentials to perform authentication. You can check more details from below linked technical articles,
http://msdn.microsoft.com/ru-ru/library/ms998351.aspx#paght000023_impersonatingorigcallertemp
Below is sample code for your reference,
// ASP.NET Impersonation
WindowsIdentity winId = (WindowsIdentity)HttpContext.Current.User.Identity;
WindowsImpersonationContext ctx = null;
try
{
var ctx = winId.Impersonate();
var mailboxUri = “https:[//test.com/ews/Exchange.asmx](https://test.com/ews/Exchange.asmx)”;
var credentials = CredentialCache.DefaultNetworkCredentials;
var client = new ExchangeWebServiceClient(mailboxUri, credentials);
}
finally
{
if(ctx != null)
ctx.Undo();
}
On the other hand, the authentication in Aspose.Email for .NET has been implemented by using ICredentials interface (for instance: NetworkCredential class implements this interface). Using Aspose.Email component, forwarding credentials to third parties is disallowed. The problem occurs when you try to pass your credentials to web-server (IIS), and then your web-application try to pass these credentials using web-services to any other server (for instance: MS Exchange). So you can use ASP.NET Impersonation if your IIS and MS Exchange are hosted on the same machine.
Thank you for your understanding.