ASP中检查没有数据提交的页面Ⅱ
ASP中检查没有数据提交的页面Ⅱ,ASP中检查没有数据提交的页面Ⅱ
对于一个表单,使用PUT和GET方法
这同样适用于从带有查询字符串连接而来的页面,比如?ID=236454
< %
If Request.Querystring = "" Then
Response.Write("< p align=""center"" >< font face=""Arial"" >There Was An
Error.< br >" & vbCrLf)
Response.Write("No Data Was Posted.< /font >
" & vbCrLf)
Response.End
End If
% >
为了含概上面例子中的情况,要做下面的工作。尽管还有简单的方法,但是这个例子对于初学者,将是很好的学习基本原理的方法。
< %
IsData = 0
If Request.Form < > "" Then IsData = IsData + 1
If Request.Querystring < > "" Then IsData = IsData + 1
If IsData = 0 Then
Response.Write("< p align=""center"" >< font face=""Arial"" >There Was An Error.< br >" & vbCrLf)
Response.Write("No Data Was Posted.< /font >
" & vbCrLf)
Response.End
End If
% >
或者
< %
IsData = "No"
If Request.Form < > "" Then IsData = "Yes"
If Request.Querystring < > "" Then IsData = "Yes"
If IsData = "No" Then
Response.Write("< p align=""center"" >< font face=""Arial"" >There Was An Error.< br >" & vbCrLf)
Response.Write("No Data Was Posted.< /font >
" & vbCrLf)
Response.End
End If
%>