如何将其他参数添加到 Request.ServerVariables.Get(“ALL_HTTP”)

本文关键字:ALL HTTP Get ServerVariables 其他 参数 添加 Request | 更新日期: 2023-09-27 17:57:10

我必须在我们的http header中添加一些额外的参数。假设我使用它必须包含一些额外的参数,并且应该在任何地方都可见。如果有人使用我的 http 标头,所有内容都应该与我的附加参数一起可见。 Request.ServerVariables.Get("ALL_HTTP");

如何将其他参数添加到 Request.ServerVariables.Get(“ALL_HTTP”)

您可以在 web.config 中添加自定义标头。例:

<configuration>
        <system.webServer>
            <httpProtocol>
                <customHeaders>
                    <add name="CustomHeader1" value="Hi" />
                </customHeaders>
            </httpProtocol>
        </system.webServer>
</configuration>