使用 asp:Button 或 asp:LinkButton 时自动重定向到附加到 URL 的查询参数的同一链接

Automatically Getting redirected to same link with query parameter attached to the URL while using an asp:Button or asp:LinkButton

提问人:n000b 提问时间:6/4/2023 最后编辑:n000b 更新时间:6/4/2023 访问量:20

问:

在使用 asp:Button 或 asp:LinkButton 时,自动重定向到附加到 URL 的查询参数的同一链接,即使没有函数调用,也会发生这种情况。

嗨,我是一名 .net 开发人员,使用 C# 2 和 VB 开发 ASP 2.0。 最近我尝试在其中一个页面上添加一个asp:button,但注意到所有使用查询字符串的页面上都发生了一件奇怪的事情,如果有asp:Button或asp:LinkButton,如果单击它,用户将被重定向到同一页面,查询字符串参数出现在URL中。

下面是测试页面的 SS(峰值是 querystring-parameter): 在点击按钮之前

下面是单击按钮后的 SS(峰值是 querystring-parameter):单击按钮后

这是我在web.config中添加的规则:

<rule name="thisistestpage" stopProcessing="true">
    <match url="^test-page/(.+)$" />
        <conditions>
            <add input="{URL}" pattern="^/test-page/(.+)$" />
        </conditions>
    <action type="Rewrite" url="testing.aspx?val={R:1}" appendQueryString="true" logRewrittenUrl="true" />
</rule>

我正在使用 asp:button,但是在按钮单击事件上没有调用任何函数,仍然有重定向,我不知道为什么会发生这种情况。如果我使用按钮,则不会发生这种情况,只有服务器控件导致了问题。 请帮帮我,提前谢谢你。

asp.net vb.net 查询字符串 C#-2.0 querystringparameter

评论


答: 暂无答案