[SOLVED] WebClientWithCredentials broken?
Posted: Sun Jun 30, 2019 12:13 pm
Trying to implement Rest API support, but I can't use the WebClientWithCredentials.Credentials mode. I get a design-time error, and my app won't compile:
So, I managed to work around this by creating a new CSHTML5 class library, and changing the alias of "CSharpXamlForHtml5.System.dll" from "global" to "sys", and then creating a new subclass of the WebClientWithCredentials class, which I called "WebClientWithAuth". Since I changed the alias of the System.dll, I was able to hard-code the CredentialsMode to Enabled, see the following sample:
Before Alias:
After Alias:
Code: Select all
client.CredentialsMode = System.Net.CredentialsMode.Enabled;
Error CS0433 The type 'System.Net.CredentialsMode' exists in both 'CSharpXamlForHtml5.System.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'CSharpXamlForHtml5, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
So, I managed to work around this by creating a new CSHTML5 class library, and changing the alias of "CSharpXamlForHtml5.System.dll" from "global" to "sys", and then creating a new subclass of the WebClientWithCredentials class, which I called "WebClientWithAuth". Since I changed the alias of the System.dll, I was able to hard-code the CredentialsMode to Enabled, see the following sample:
Before Alias:
After Alias: