pnp / pnpframework

PnP Framework is a .NET library targeting Microsoft 365 containing the PnP Provisioning engine and a ton of other useful extensions
https://pnp.github.io/pnpframework/
MIT License
205 stars 143 forks source link

Page Timeout Exception while create SharePoint Client Context using PNP.Framework in ASP.Net Site #452

Open vivekagrawal1110 opened 3 years ago

vivekagrawal1110 commented 3 years ago

I have an Azure ASP.Net Web site. In page load event, creating SharePoint Client Context using Azure AD Application.

Page keeps on loading and after some time shows page timeout exception. Using below code to create SharePoint Client Context. This code is working in console application but not in ASP.Net page. Please let me know how to fix this.

public static ClientContext GetClientContextFromrAzureApp(string siteURL, X509Certificate2 CertApp) { string tenantId = "dbc1c245-33df-411f-a421-..."; string ClientId = "7f4ff27b-4200-4cba-a666-....";// Azure AD Application ID

using (var manager = new PnP.Framework.AuthenticationManager(ClientId, new X509Certificate2(CertApp), tenantId, "", AzureEnvironment.USGovernmentHigh))
{
    manager.ClearTokenCache();
    return manager.GetContext(siteURL);
}

}

jansenbe commented 3 years ago

seems related to #447