经典ASP CStr无法正常工作

时间:2013-05-14 21:31:24

标签: regex asp-classic

我需要帮助 Error 800A000D - Type mismatch ,我将收到以下信息:

<!-- #include file="Regex.asp" -->
<%
Call moverzipado()

Sub moverzipado()
    dim nomeArquivoZip, nomeArquivo 
    nomeArquivo = request("nomeArquivo")
    nomeArquivoZip = NomeArquivo(trim(CStr(nomeArquivo)))&".zip" 'here is the problem
End Sub

这是我的查询字符串: ?nomeArquivo=arquivo.zip

这是Regex.asp包含的。它正在发挥作用。

<%
Function RegExResults(strTarget, strPattern)

    Set regEx = New RegExp
    regEx.Pattern = strPattern
    regEx.Global = true
    Set RegExResults = regEx.Execute(strTarget)
    Set regEx = Nothing

End Function

Function NomeArquivo(arquivo)
    Set arrResults = RegExResults(arquivo, "(.*)\..*")

    For each result in arrResults
        NomeArquivo = result.Submatches(0)
    Next

    Set arrResults = Nothing
End function

'Response.Write(NomeArquivo("file.exe")) prints "file" here it works.
%>

有人知道发生了什么吗?

1 个答案:

答案 0 :(得分:3)

vbScript不区分大小写。看来你有一个变量和一个有效同名的函数。尝试更改函数或变量的名称。