开发者

WCF String DataMemeber fails with special characters

开发者 https://www.devze.com 2022-12-11 14:50 出处:网络
I have a simple DataContract structured in this way: [DataMember(EmitDefaultValue = false, IsRequired = true, Name = \"TablePath\", Order = 1)]

I have a simple DataContract structured in this way:

    [DataMember(EmitDefaultValue = false, IsRequired = true, Name = "TablePath", Order = 1)]
    public string TablePath { get; set; }

The Value that I try to insert is something like that:

%PATH%\%SPECIAL%\file.txt

And I receive this message using the WCF Test Client UI

"... is not a valid value for this type." I tried different combinations of characters, and for example something like this works great "%PATH%".

The problem is if there is a combination like "%\".

How I can fix this problem as I will receive any type of characters inside this property?

开发者_StackOverflow社区

Thank you in advance.


Did you try adding the @ sign before the string @"%PATH%\%SPECIAL%\file.txt" ?

Without it I think you need to use "\ \" instead of "\" .....


It seems that the problem is only with the WCF Test Client tool. If I use the same metadata through C# it works ... Weird as I don't have a UI now to test my services ... I must work with TDD.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号