kumar
kumar

Reputation: 9417

Azure API managment Policy check contain for URL

I am trying to set variable if url contains text "verification"

<set-variable name="pathQuery" value="@(context.Request.Url.Contains("verification"))" />

I get the following error

Error in element 'set-variable' on line 16, column 10: 'IUrl' does not contain a definition for 'Contains' and the best extension method overload 'Queryable.Contains(IQueryable, string)' requires a receiver of type 'IQueryable'

How do I set this?

Upvotes: 0

Views: 3455

Answers (1)

Joey Cai
Joey Cai

Reputation: 20127

You could use the code as below:

<set-variable name="pathQuery" value="@(context.Request.Url.Path.Contains("verification"))" />

For more details, you could refer to this article.

Upvotes: 4

Related Questions