Can anyone tell me why my program thinks I am trying to make a local connection when I set the machine name value to a remote host (i.e. not localhost)
private void cmdGo_Click(object sender, System.EventArgs e) {
treeControl.Nodes.Clear();
String machineName = txtMachineName.Text;
if (machineName.CompareTo("localhost") == 0) {
?// do nothing with connection options as this is a local connection
} else {
?objectConnection.Username = txtUsername.Text;
?objectConnection.Password = txtPassword.Text;
}
objectManagementScope = new ManagementScope("\\\\" + machineName, objectConnection);
try {
?objectManagementScope.Connect();
}
catch (System.Exception ex) {
?MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
etc...
When the code reaches the ".Connect();" part I get this error message:
"User credentials cannot be used for local connections"
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Management.ManagementException: User credentials cannot be used for local connections
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementScope.InitializeGuts()
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObjectSearcher.Initialize()
at System.Management.ManagementObjectSearcher.Get()
at WMI_Windows_App.frmMain.getDiskInfo() in c:\documents and settings\mark\my documents\visual studio projects\behind the minority report\main.cs:line 318
at WMI_Windows_App.frmMain.cmdGo_Click(Object sender, EventArgs e) in c:\documents and settings\mark\my documents\visual studio projects\behind the minority report\main.cs:line 269
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.PerformClick()
at System.Windows.Forms.Button.ProcessMnemonic(Char charCode)
at System.Windows.Forms.Control._ProcessMnemonic(Char charCode)
at System.Windows.Forms.ContainerControl.ProcessMnemonic(Char charCode)
at System.Windows.Forms.ContainerControl.ProcessDialogChar(Char charCode)
at System.Windows.Forms.Control.ProcessDialogChar(Char charCode)
at System.Windows.Forms.Control.ProcessDialogChar(Char charCode)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.ThreadContext.System.Windows.Forms.UnsafeNativeMethods+IMsoComponent.FPreTranslateMessage(MSG& msg)
Mozilla should shut down everything except the browser and the services they whitelabel (for example Firefox VPN from Mullvad).
Everything else just cost them money and have never returned any revenue.
Focusing in the browser is what makes sense considering what is going to change regarding their income sources.
About Firefox and chromium... if they ever have to abandon Gecko because of financial issues it is more likely to use Apple's WebKit and not Chromium and Blink.
WebKit is more versatile for Firefox because it will allow them even to keep Firefox's extension ecosystem. The same way GNOME Web which is a WebKit browser has experimental Firefox extension support.
I really dont like how they’ve put shadows under window elements making the sidebar and toolbar buttons look like they sit above the window itself. Looks very odd and clunky.
Question
84Mark
Can anyone tell me why my program thinks I am trying to make a local connection when I set the machine name value to a remote host (i.e. not localhost)
When the code reaches the ".Connect();" part I get this error message:
"User credentials cannot be used for local connections"
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Management.ManagementException: User credentials cannot be used for local connections
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementScope.InitializeGuts()
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObjectSearcher.Initialize()
at System.Management.ManagementObjectSearcher.Get()
at WMI_Windows_App.frmMain.getDiskInfo() in c:\documents and settings\mark\my documents\visual studio projects\behind the minority report\main.cs:line 318
at WMI_Windows_App.frmMain.cmdGo_Click(Object sender, EventArgs e) in c:\documents and settings\mark\my documents\visual studio projects\behind the minority report\main.cs:line 269
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.PerformClick()
at System.Windows.Forms.Button.ProcessMnemonic(Char charCode)
at System.Windows.Forms.Control._ProcessMnemonic(Char charCode)
at System.Windows.Forms.ContainerControl.ProcessMnemonic(Char charCode)
at System.Windows.Forms.ContainerControl.ProcessDialogChar(Char charCode)
at System.Windows.Forms.Control.ProcessDialogChar(Char charCode)
at System.Windows.Forms.Control.ProcessDialogChar(Char charCode)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.ThreadContext.System.Windows.Forms.UnsafeNativeMethods+IMsoComponent.FPreTranslateMessage(MSG& msg)
Link to comment
https://www.neowin.net/forum/topic/239518-c-user-credentials-error-for-local-connections/Share on other sites
2 answers to this question
Recommended Posts