This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bindings> | |
<netTcpBinding> | |
<binding name="tcp_auth" | |
portSharingEnabled="false"> | |
<security mode="Message"> | |
<message clientCredentialType="UserName"/> | |
</security> | |
</binding> | |
</netTcpBinding> | |
</bindings> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<behaviors> | |
<serviceBehaviors> | |
<behavior name ="beh_auth"> | |
<serviceMetadata/> | |
<serviceCredentials> | |
<userNameAuthentication | |
userNamePasswordValidationMode="Custom" | |
customUserNamePasswordValidatorType="YOUR_HOST_NAMESPACE.YOUR_CUSTOM_VALIDATOR, YOUR_ASSEMBLY_NAME"/> | |
<serviceCertificate | |
findValue="YOUR_CERT_NAME" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<client> | |
<endpoint address="YOUR_SERVICE_URL" | |
binding="netTcpBinding" | |
bindingConfiguration="NetTcpBinding_YOUR_REFERENCED_SERVICE_INTERFACE" | |
contract="YOUR_REFERENCED_SERVICE.YOUR_REFERENCED_SERVICE_INTERFACE" | |
name="NetTcpBinding_YOUR_REFERENCED_SERVICE_INTERFACE"> | |
<identity> | |
<dns value="dev_cert_2"/> | |
<certificate encodedValue="..." /> | |
</identity> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
Service1Client client = null; | |
try | |
{ | |
// Create the client | |
// It will use the settings in the app.config file | |
client = new Service1Client(); | |
// Set credentials | |
client.ClientCredentials.UserName.UserName = "USER_PASSWORD"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum MyStringEnum | |
{ | |
Text1 = "My text 1", | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// This attribute allows to attach to any | |
/// class, method, property or enumerator member | |
/// a string value. | |
/// </summary> | |
public class StringValueAttribute : Attribute | |
{ | |
/// <summary> | |
/// Returns the attached string value. | |
/// </summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Provides the tools needed to get in a easy, fast way | |
/// the string value of an enumerator member assigned | |
/// with <see cref="StringValueAttribute"/>. | |
/// </summary> | |
/// <typeparam name="E">The type of the enumerator.</typeparam> | |
public static class StringEnum<E> | |
{ | |
/// <summary> | |
/// Gets the enumerator member's string value. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// This is an example of how to implement | |
/// an string enum. | |
/// </summary> | |
public enum MyStringEnum | |
{ | |
[StringValue("This is the string value 1.")] | |
Member1, | |
[StringValue("This is the string value 1.")] | |
Member2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the value from the first member of the enumerator. | |
string value = StringEnum<MyStringEnum>.Value(MyStringEnum.Member1); | |
// Parse the value to re-obtain the member. | |
MyStringEnum member = StringEnum<MyStringEnum>.Parse(value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
partial class WinFormsFlashControl :System.Windows.Forms.UserControl | |
{ | |
private Uri _source; | |
/// <summary> | |
/// Gets or sets the path to the .swf file. | |
/// </summary> | |
/// <exception cref="FileNotFoundException">Occurs when | |
/// the specified file is not found.</exception> | |
public Uri Source |