为什么我的 response.redirect() 无法正常工作?

发布于 2024-12-08 10:03:01 字数 768 浏览 0 评论 0原文

该问题涉及两个aspx页面。在一种形式中,我收集实体并将其绑定在会话变量中,然后单击按钮,我尝试使用 response.redirect("") 方法访问另一个 aspx 页面。但是,问题是它给了我一条带有奇怪 URl 的错误消息。

让我向您展示我编写的代码

 formSaleMoneyReceiptEntity = ViewFormSaleMoneyReceipt_DAO.GetMoneyReceiptByFormSL(formSl);
            Session["MoneyReceipt"] = formSaleMoneyReceiptEntity;
            Response.Redirect("~/Reports/MoneyRepeiptFormReport.aspx",false);

,我正在使用本地主机,我得到的 URl 是

http://www.google-feed.net/results.php?q=localhost 5808 学生管理表格SaleMoneyReceipt aspx &cx=002904446094441487865%3Ate-nlsbrcdy&cof=FORID%3A10&ie=UTF-8&said=&do=search&empty=0&from=2&CID=1

为什么会这样?我不知道。请帮帮我。

Two aspx pages are involved with the problem. in one form I am collecting the entity and binding it in a session variable and then with button clicked, I am trying to get to the other aspx page with response.redirect("") method. But, the problem is its gives me an error message with a strange URl.

let me show you the code I have writen

 formSaleMoneyReceiptEntity = ViewFormSaleMoneyReceipt_DAO.GetMoneyReceiptByFormSL(formSl);
            Session["MoneyReceipt"] = formSaleMoneyReceiptEntity;
            Response.Redirect("~/Reports/MoneyRepeiptFormReport.aspx",false);

I am using local host and the URl I am getting is that

http://www.google-feed.net/results.php?q=localhost 5808 StudentManagement FormSaleMoneyReceipt aspx &cx=002904446094441487865%3Ate-nlsbrcdy&cof=FORID%3A10&ie=UTF-8&said=&do=search&empty=0&from=2&CID=1

why is this so? I don't have any idea. Please help me out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾城泪 2024-12-15 10:03:01

传递到浏览器的 URL 似乎不存在,因此您会重定向到 Google 搜索页面。

~/Reports/MoneyReceiptFormReport.aspx 吗?

用于调试这种情况的一个好工具是 Fiddler。它作为 Web 服务器和浏览器之间的代理,并跟踪所发出的请求和响应。浏览器有重新格式化错误消息的习惯,Fiddler 会准确地向您显示发送到服务器的内容以及返回的内容。

It looks like the URL that is passed to the browser doesn't exist, so you're getting a redirect to a Google search page instead.

Is it ~/Reports/MoneyReceiptFormReport.aspx by any chance?

A good tool to use to debug this kind of situation is Fiddler. This sits as a proxy between your Web server and your browser and issues a trace of what requests and responses are made. Browsers have a habit of reformatting error messages, Fiddler will show you exactly what's sent to the server and what comes back.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文