Asp.net Vbscript 错误 [英] Asp.net Vbscript Error
问题描述
请告诉我我在这个脚本中哪里出错了.我收到此错误.
Please tell me where I have gone wrong in this script. I am getting this error.
编译错误说明:在编译服务此请求所需的资源期间发生错误.请查看以下特定错误详细信息并适当修改您的源代码.
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
编译器错误消息:BC30002:未定义类型ProcessStartInfo".
Compiler Error Message: BC30002: Type 'ProcessStartInfo' is not defined.
源错误:
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
Source File: C:\Inetpub\wwwroot\ServiceFileUploadRE.aspx Line: 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>
.......
推荐答案
也许放行
<%@ Import Namespace = "System.Diagnostics" %>
直接在 <% Page...
之后.
如果这不起作用,请检查您是否使用 .NET Framework 4.
If that does not work, then check whether you are using .NET Framework 4.
这篇关于Asp.net Vbscript 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!