if (User.GetType() != typeof(WindowsPrincipal))
{
//User is not authenticated
//handle the error or redirect to errorpage
return;
}
else
{
WindowsIdentity id = (WindowsIdentity)User.Identity;
WindowsImpersonationContext impersonate = id.Impersonate();
}
ExchangeServiceBuilding esb = new ExchangeServiceBuilding();
esb.Credentials = System.net.CredentialCache.DefaultNetworkCredentials ;
esb.Url = @"http://ipaddress/ews/exchange.asmx";
impersonate.Undo();