【Azure API 管理】Azure API Management在设置 Policy时,如何对URL进行解码呢? 使用 HttpUtility.UrlDecode 出错

简介: 【Azure API 管理】Azure API Management在设置 Policy时,如何对URL进行解码呢? 使用 HttpUtility.UrlDecode 出错

问题描述

Azure API Management在设置 Policy时,如何对URL进行解码呢? 使用 HttpUtility.UrlDecode 出错,是否有其他可以对URL解码的方法呢?

使用HttpUtility.UrlDecode出错:The name 'HttpUtility' does not exist in the current context.

问题解决

因为APIM中的策略(Policy)定义可以自动允许使用.Net Framework中的类。而HttpUtility 的命名空间为 System.Web 不在此列表中。所以需要使用 System.Net.WebUtility.UrlDecode 代替 HttpUtility.UrlDecode 来解码 URL。

 

查看全部列表可参考:https://docs.azure.cn/zh-cn/api-management/api-management-policy-expressions#net-framework-types-allowed-in-policy-expressions

 

下表列出了策略表达式中允许的 .NET Framework 类型及其成员(摘录部分与本文相关

类型 受支持的成员
。。。 。。。
System.MidpointRounding 全部
System.Net.IPAddress 全部
System.Net.WebUtility 全部
System.Nullable 全部
。。。 。。。

修改后的结果为:System.Net.WebUtility.UrlDecode 对于浏览器自动编码后的URL进行解码成功。

 

 

参考资料

策略表达式中允许的 .NET Framework 类型: https://docs.azure.cn/zh-cn/api-management/api-management-policy-expressions#net-framework-types-allowed-in-policy-expressions

 

相关文章
|
20天前
|
安全 API 网络安全
【Azure API 管理】APIM不能连接到 App Service (APIM cannot connect to APP service)
【Azure API 管理】APIM不能连接到 App Service (APIM cannot connect to APP service)
|
20天前
|
API 开发工具 网络架构
【Azure Developer】如何通过Azure Portal快速获取到对应操作的API并转换为Python代码
【Azure Developer】如何通过Azure Portal快速获取到对应操作的API并转换为Python代码
|
20天前
|
存储 机器学习/深度学习 API
【Azure 存储服务】记一次调用Storage Blob API使用 SharedKey Authorization出现的403错误
【Azure 存储服务】记一次调用Storage Blob API使用 SharedKey Authorization出现的403错误
|
20天前
|
存储 Kubernetes API
【APIM】Azure API Management Self-Host Gateway是否可以把请求的日志发送到Application Insights呢?让它和使用Azure上托管的 Gateway一样呢?
【APIM】Azure API Management Self-Host Gateway是否可以把请求的日志发送到Application Insights呢?让它和使用Azure上托管的 Gateway一样呢?
|
20天前
|
API 网络架构 C++
【Azure Key Vault】使用REST API调用Azure Key Vault Secret的示例步骤
【Azure Key Vault】使用REST API调用Azure Key Vault Secret的示例步骤
|
20天前
|
API 网络架构
【Azure Developer】使用 Microsoft Graph API查看用户状态和登录记录
【Azure Developer】使用 Microsoft Graph API查看用户状态和登录记录
|
20天前
|
存储 安全 API
【Azure API Management】实现在API Management服务中使用MI(管理标识 Managed Identity)访问启用防火墙的Storage Account
【Azure API Management】实现在API Management服务中使用MI(管理标识 Managed Identity)访问启用防火墙的Storage Account
|
30天前
|
开发框架 前端开发 .NET
Asp.net Webapi 的 Post 方法不能把参数加到 URL 中?试试这样写
Asp.net Webapi 的 Post 方法不能把参数加到 URL 中?试试这样写
|
1月前
|
Java
JAVA 获取 URL 指定参数的值
JAVA 获取 URL 指定参数的值
30 0
|
2月前
|
JavaScript 前端开发 数据格式
URL编码【详解】——Javascript对URL进行编码解码的三种方式的区别和使用场景,axios请求拦截器中对get请求的参数全部进行URL编码
URL编码【详解】——Javascript对URL进行编码解码的三种方式的区别和使用场景,axios请求拦截器中对get请求的参数全部进行URL编码
60 0