【问题标题】:How to consume URL parameters using anchor如何使用锚点使用 URL 参数
【发布时间】:2021-12-18 18:46:11
【问题描述】:

我正在使用 Azure Function 隔离 .net 5 HttpTrigger。

当使用'#'而不是'?'传递参数时如何使用URL'参数'?

示例:https//some.sample.url/path#param1=someValue&param2=someOtherValue

我需要这些值:

param1=someValue;
param2=someOtherValue;

背景资料:

https://www.rfc-editor.org/rfc/rfc6749@4.2.2。访问令牌响应:

For example, the authorization server redirects the user-agent by
   sending the following HTTP response (with extra line breaks for
   display purposes only):

 HTTP/1.1 302 Found
 Location: http://example.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA
           &state=xyz&token_type=example&expires_in=3600

【问题讨论】:

    标签: url azure-functions .net-5 url-parameters


    【解决方案1】:

    没有。在 Azure Functions 服务器端,您将无法访问请求 URL 中 # 之后的任何内容。

    URL 片段标识符旨在供客户端(用户代理/浏览器)使用。它们用于导航到 HTML 文档的特定子部分或其他客户端用户体验增强功能。如果您尝试 URL https://www.bing.com/#foo=test&bar=test2 并观察来自浏览器的网络流量,您可以看到片段标识符 (#) 之后的任何内容都没有发送到服务器。

    如果您想访问服务器端的一些附加信息,请考虑将它们作为查询字符串发送。例如:https://www.bing.com?param1=someValue&param2=someOtherValue

    【讨论】:

    • 谢谢@Shyju。这是正确的,并在rfc-editor.org/rfc/rfc1808.txt 中指定。问题是在 rfc6749(参见上面的背景信息)中,访问令牌响应被指定为使用片段标识符 (#)。所以我想知道是否有可能以某种方式访问​​这些参数。我使用第三方令牌提供程序,它使用 # 发送参数。但是对于这个问题,我有这个问题 (stackoverflow.com/questions/69839486/…)
    猜你喜欢
    • 2011-04-02
    • 1970-01-01
    • 1970-01-01
    • 2017-06-20
    • 1970-01-01
    • 2021-05-11
    • 2014-04-02
    • 1970-01-01
    • 2019-12-17
    相关资源
    最近更新 更多