Tools, FAQ, Tutorials:
Using .NET CLR Types in Azure API Policy
How to use .NET CLR Types in Azure API Policy?
✍: FYIcenter.com
By default, Azure imports many basic .NET CLR (Common Language Runtime) types
into the API policy execution environment.
Imported .NET CLR types can be used in any "@(...)" expressions or "@{...}" expression blocks.
For example, the following "@{...}" expression block retrieves the request header "Authorization" value, performs Base64 decoding on the value, then returns it in UTF8 format:
@{ string value; if (context.Request.Headers.TryGetValue("Authorization", out value)) { return Encoding.UTF8.GetString(Convert.FromBase64String(value)); } else { return null; } }
Two .NET CLR types are used in the above expression block: "System.Encoding" and "System.Convert".
Here is list of all Imported .NET CLR types:
Newtonsoft.Json.Linq.* System.Collections.Generic.* System.Convert System.DateTime System.DateTimeKind System.DateTimeOffset System.Decimal System.Double System.Encoding System.Guid System.IEnumerable System.IEnumerator System.Int16 System.Int32 System.Int64 System.Linq.Enumerable System.Math System.MidpointRounding System.Nullable System.Random System.SByte System.Security.Cryptography.* System.Single System.String System.StringSplitOptions System.Text.* System.TimeSpan System.Tuple System.UInt16 System.UInt32 System.UInt64 System.Uri System.Xml.Linq.* System.Xml.XmlNodeType
For more information on Imported .NET CLR types, see API Management policy expressions Website.
Â
⇒ 'set-variable' Statement to Create Custom Variables
2018-01-24, 2456👍, 0💬
Popular Posts:
How to create Hello-3.1.epub with WinRAR? I have all required files to create Hello-3.1.epub. To cre...
How to access Request body from "context.Request.Body" object in Azure API Policy? Request body is t...
How to use "xsl-transform" Azure API Policy Statement? The "xsl-transform" Policy Statement allows y...
How to add images to my EPUB books Images can be added into book content using the XHTML "img" eleme...
FYIcenter JSON Validator and Formatter is an online tool that checks for syntax errors of JSON text ...