在ASP.Net VB.Net中我似乎没有反斜杠。在VB.Net路径中的反斜杠
我想输出一些相关信息有关文件与ffprobe和我的路径是在包含反斜线每个字符串一些反斜杠随机切割。
我调试这个函数返回由fileToProcess生成的路径:
Function ffprobe_show_format(ByVal arg As String) As String
Dim myProcess As New System.Diagnostics.Process()
Dim fileToProcess As String = MapPath(".") & "\temps\" & arg
myProcess.StartInfo.FileName = MapPath(".") & "\ffprobe.exe"
myProcess.StartInfo.Arguments = "-show_format " & fileToProcess & " >C:\inetpub\vhosts\mysite.com\httpdocs\absolutefs\ffmpegtemp.txt"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start()
Dim myStreamWriter As StreamWriter = myProcess.StandardInput
Dim mystreamreader As StreamReader = myProcess.StandardOutput
Dim str As String = mystreamreader.ReadToEnd
Return str & ";" & "FileToProcess=" & fileToProcess & "MapPath(.) AND ffprobe.exe" & MapPath(".") & "\\ffprobe.exe"
End Function
,并返回;FileToProcess=C:
这意味着
- 我的文件是不是因为一些错误的处理
- 我的路径是反斜杠
- 然后打破字符串的其余部分
是否需要告诉asp.net以另一种方式表示反斜杠?
[编辑]
我不能选择一个答案,但会给予好评,因为我犯了两个错误: - 要调试,我读我的价值,一旦它被放在SQL变量与限制一个大小,然后 - ...使用Newtonsoft.Json解析器获取,可能会拒绝某些字符。
我是新上的ASP.Net,所以我必须找到调试的好方法困难。于是,我终于做出像往常一样,当我不能够在一个平台上进行调试:我写我的调试在一个文本文件瓦尔,一切都在那里用这种方式:
Function ffprobe_show_format(ByVal file As String, ByVal app As String) As String
Dim myProcess As New System.Diagnostics.Process()
myProcess.StartInfo.FileName = app
Dim argz As String = FormatCommandLine("-show_format", file)
myProcess.StartInfo.Arguments = argz
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start()
Dim mystreamreader As StreamReader = myProcess.StandardOutput str As String = mystreamreader.ReadToEnd
MapPath(".") & "/ffprobe.exe"
Dim objWriter As New System.IO.StreamWriter(MapPath(".") & "\debug.txt")
objWriter.Write(str)
objWriter.Close()
Return str
End Function
我加入了一个ffmpeg标记,因为这也是如何调用它并处理文件的另一个示例。
VB字符串不需要与C#字符串相同的转义。通常你只需要担心双引号,并且你只需在VB中加倍“”就可以转义。 – mgnoonan
无法在VB.Net中工作 –