Search code examples
sharepoint-onlinecsomoffice-dev-pnp

OfficeDevPnP.Core.AuthenticationManager GetWebLoginClientContext throws "Navigation to the webpage was canceled"


I have a small application that connects to a sharepoint-list. For this, we use the following (VB.NET) code:

Imports Microsoft.SharePoint.Client

Public Class SendDataToSharePointList

Private SharePointSite As String '= download from database

Private authManager As New OfficeDevPnP.Core.AuthenticationManager

Private Sub Connect()
    clientcontext = authManager.GetWebLoginClientContext(SharePointSite)
    ....
End Sub

This works perfectly fine for 99% of our users: the "GetWebLoginClientContext" throws a log-in screen and when connected, the screen disappears.

However, one user reported the following error: enter image description here

And we can't figure out why... Changing the IE security settings and removing the cookies in IE has no effect. Anyone has an idea what is causing this?

Many thanks!


Solution

  • This call invokes internally embedded control of Internet Explorer. In server systems where Internet Explorer enhanced security is enabled by default, redirection to Microsoft login page is cancelled as insecure. Disable enhanced security of Internet Explorer to resolve this issue. It is done in Server Manager. You must reboot Windows to have it disabled.