ASP.NET Impersonation

Is it possible to connect to Exchange through Aspose.Email, using the impersonated users login?

Hi Darren,


Thank you for your inquiry.

Yes it is possible to connect to Exchange through Aspose.Email for .NET using the impersonated user login.

Please refer to the following link and let us know if it has resolved your issue:
https://forum.aspose.com/t/41739

Best Regards

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.


I have an asp.net application that uses Windows authentication, and impersonation, and I need to give my users the ability to connect to their existing exchange server without storing their password, prompting them for their password, and without creating an Exchange impersonation account.

Hi Darren,


Thank you for the clarification on your inquiry.

We are currently looking into this feature, and how to accomplish your goals using Aspose.Email for .NET component. We will keep you informed regarding any updates.

Regards,

Hi,


Sorry for the delayed response.

I have worked with your scenario, and unfortunately I am unable to make Aspose.Email for .NET work as per your requirement. In order to sought help from the development team in this regard, I have logged an investigative ticket (NETWORKNET-33352). As soon as I receive further news, I will post here for your kind reference.

Regards,

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.