I have the following web method:
<WebMethod()> _ <ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=True, XmlSerializeString:=True)> _ Public Function GetDictionary() As Dictionary(Of String, String) Dim d As New Dictionary(Of String, String) d.Add("key1", "value1") d.Add("key2", "value2") Return d End Function
I can get the results in order (JSON) if I use HttpPost from my ajax call, but as soon as I use HttpGet, I get the following exception:
System.NotSupportedException: type System.Collections.Generic.Dictionary`2 [[System.String, mscorlib, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089], [System.String, mscorlib, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089]] is not supported because it implements IDictionary
I wanted to use HttpGet here so that the result can be cached.
I tried all the options for calling this, but no luck. Any ideas? Is this possible with GET?
source share