Upgrade of CMD Commands in ASP.NET Environment

xiaoxiao2021-03-06  95

I used to write an article called "CMD command execution in the ASP.NET environment"; the post was first sent to the security focus and phantom brigade. Later, the phantom had a reply called the old Kai, saying that the output redirection without a temporary file, Lake2 is successful. Here, a core code based on VB.NET is given:

Quote:

Dim myProcess As New Process () Dim myProcessStartInfo As New ProcessStartInfo ( "cmd.exe") myProcessStartInfo.UseShellExecute = FalsemyProcessStartInfo.RedirectStandardOutput = truemyProcess.StartInfo = myProcessStartInfomyProcessStartInfo.Arguments = "/ c" & Cmd.textmyProcess.Start () Dim myStreamReader As StreamReader = myprocess.standardoutputdim mystring as string = mystreamReader.ReadToEnd () MyProcess.close () Result.text = cmd.text & vbcrlf & "& mystring &" "

Here is the New ProcessStartInfo class, please refer to the full ASPX program for .NET documentation can be downloaded here.

转载请注明原文地址:https://www.9cbs.com/read-123360.html

New Post(0)