asp Server.Transfer放置参数
我用谷歌搜索了许多示例,所有示例都显示了此类代码
Server.Transfer("/default.asp?p=news")
,但出现错误 - 在 MapPath 方法的 Path 参数中指定了无效字符。
你能帮助我吗?
i googled many samples, all show such code
Server.Transfer("/default.asp?p=news")
but i get error -An invalid character was specified in the Path parameter for the MapPath method.
can you help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Server.Transfer 方法实际上不支持路径中指定的任何类型的查询字符串。您可以尝试将查询参数存储在会话值中。
一些讨论:
http:// /classicasp.aspfaq.com/general/why-won-t-querystring-values-work-with-server-execute/server-transfer.html
Server.Transfer method actually doesn't support any kind of querystring specified in the path. You can try to store the query parameter in a session value instead.
Some discussions:
http://classicasp.aspfaq.com/general/why-won-t-querystring-values-work-with-server-execute/server-transfer.html
以下可能是使用 server.transfer 或 response.redirect 的解决方法。
The following might be a work around to using server.transfer or response.redirect.
您必须在服务器传输的页面上包含您的查询字符串。
即:
page.asp?p=news 将包括:
default.asp 将包括:
这应该可行,或者如果您的应用程序不能灵活地执行此操作,您可以使用
Session
来传递值。这里说明了允许使用 Server.Transfer 传递变量的方法:http://msdn.microsoft.com/en-us/library/ms525800%28v=vs.90%29.aspxYou would have to include your querystring on the page that does the server transfer.
Ie:
page.asp?p=news would include:
default.asp would include:
This should work, or if your app isn't flexible to do this, you can use
Session
to pass the value. It says here which methods are allowed for passing variables usingServer.Transfer
: http://msdn.microsoft.com/en-us/library/ms525800%28v=vs.90%29.aspx