加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

在ASP.Net中使用参数

发布时间:2020-12-16 06:48:30 所属栏目:asp.Net 来源:网络整理
导读:在我的ASP.Net网站中,我使用 httpRedirect永久地将URL重定向到其他位置.在web配置中. 我正在从表中读取URL值并使用Response.Redirect(URL)重定向到该URL; 它工作得很完美. 但是现在当我尝试使用以下命令将参数发送到调用页面时: Response.Redirect("Default
在我的ASP.Net网站中,我使用< httpRedirect>永久地将URL重定向到其他位置.在web配置中.
我正在从表中读取URL值并使用Response.Redirect(URL)重定向到该URL;
它工作得很完美.
但是现在当我尝试使用以下命令将参数发送到调用页面时:

Response.Redirect("Default.aspx?name=stackoverflow");

< httpRedirect>在web.config中调用Default2.aspx,因为web.config中有以下代码:

<location path="Default.aspx">
    <system.webServer>
        <httpRedirect enabled="true" destination="Default2.aspx" httpResponseStatus="Permanent" />
    </system.webServer>
</location>

问题是Default2.aspx没有收到任何参数.
请帮忙.

注意:我不能使用会话变量,因为页面内容取决于该参数.

例如,
如果用户使用Default.aspx在新选项卡中打开另一个页面?name = MetaStackOverflow会话变量将被替换,如果刷新第一页,则不会显示Stackoverflow内容,而是显示MetaStackOverflow.

解决方法

不要忘记特殊字符$V $Q和exactDestination必须设置为True.

< location path =“帮助”>????< system.webServer>??????< httpRedirect enabled =“true”destination =“/ Redirect.aspx $V $Q”httpResponseStatus =“Permanent”exactDestination =“true”/>????< /system.webServeru0026gt;??< /地点>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读