Reputation: 3
I use method GetWebLoginClientContext to access Sharepoint with MFA.
It was perfect since multiple users will use this program and i didn't want user to write any password/got any credential within code for security sake.
This worked for few days then now i got below screen saying that browser needs now to be updated. Is there any workarround ? or other method that do not required any credential ?
public static ClientContext connectToSharepoint(string siteUrl)
{
var authManager = new OfficeDevPnP.Core.AuthenticationManager();
ClientContext context = authManager.GetWebLoginClientContext(siteUrl);
return context;
}
I tried several other method but nothing worked
** SOLVED ** added this code and it worked
using (var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(
@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION",
true))
{
var app = System.IO.Path.GetFileName(Application.ExecutablePath);
key.SetValue(app, 11001, Microsoft.Win32.RegistryValueKind.DWord);
key.Close();
}
Upvotes: 0
Views: 351
Reputation: 3
Solved : Added this before my code and it worked
using (var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(
@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION",
true))
{
var app = System.IO.Path.GetFileName(Application.ExecutablePath);
key.SetValue(app, 11001, Microsoft.Win32.RegistryValueKind.DWord);
key.Close();
}
Upvotes: 0