【发布时间】:2011-07-26 16:44:44
【问题描述】:
请告诉我这个脚本哪里出了问题。我收到此错误。
“/”应用程序中的服务器错误。
编译错误 说明:在编译服务此请求所需的资源期间发生错误。请查看以下特定错误详细信息并适当修改您的源代码。
编译器错误消息:BC30002:未定义类型“ProcessStartInfo”。
来源错误:
Line 5: Public Shared Function ExecuteCommand(Command As String, Timeout As Integer) As Integer
Line 6: Dim ExitCode As Integer
*Line 7: Dim ProcessInfo As ProcessStartInfo*
Line 8: Dim Process As Process
Line 9:
源文件:C:\Inetpub\wwwroot\ServiceFileUploadRE.aspx 行:7
脚本:
<%@ Page Language=VBScript %>
<script runat="server">
Public Shared Function ExecuteCommand(Command As String, Timeout As Integer) As Integer
Dim ExitCode As Integer
Dim ProcessInfo As ProcessStartInfo
Dim Process As Process
ProcessInfo = New ProcessStartInfo("cmd.exe", "/C " + Command)
ProcessInfo.CreateNoWindow = True
ProcessInfo.UseShellExecute = False
Process = Process.Start(ProcessInfo)
Process.WaitForExit(Timeout)
ExitCode = Process.ExitCode
Process.Close()
Return ExitCode
End Function
Protected Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
If FileUpload1.HasFile Then
Try
FileUpload1.SaveAs("C:\Inetpub\wwwroot\upload\" & _
FileUpload1.FileName)
Label1.Text = "File name: " & _
FileUpload1.PostedFile.FileName & "<br>" & _
"File Size: " & _
FileUpload1.PostedFile.ContentLength & " kb<br>" & _
"Content type: " & _
FileUpload1.PostedFile.ContentType
Catch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
Label1.Text = "You have not specified a file."
End If
End Sub
ExecuteCommand("REN C:\Document.rtf YES.rtf",100)
</script>
.......
【问题讨论】: