[英]classic asp - response.redirect and response.write problem
问题是,如果有人在搜索框中键入要转到该位置页面的位置,但是如果他们键入找不到的位置,或者他们没有输入任何内容,则需要将其重定向回首页(index.asp)并显示搜索框(输入字段)中“ whops we not found that”
这是vb
Case Else
response.redirect "index.asp?whoops=whoops we couldnt find that"
End Select
然后在输入字段的值中
value="<% =whoops %>"
顺便说一句,这是行不通的,首先是这样做的最佳方法,因为id而不是URL中没有错误消息。 这样就可以将错误作为变量发布,然后将其调用到输入字段中,例如,
<% =whoops %>
您不需要网址中的错误消息。 另外, whoops
不能仅作为变量存在于URL中而作为变量使用。 您必须在Request.Querystring集合中查找它。 您要做的是在首页上执行以下操作:
Dim whoops : whoops = ""
If Request.Querystring("whoops") Then
whoops = "whoops we couldnt find that"
End If
然后,您可以输出<%= whoops%>作为搜索框的HTML值属性。 这也将阻止人们将他们想要的任何东西分配给whoops的值,这是一个安全漏洞。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.