为什么我的 response.redirect() 无法正常工作?
该问题涉及两个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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
传递到浏览器的 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.