Re: why does this fail to run
From: Rob Y (ryacullo@telsource.com)
Date: 10/24/02
- Next message: Joseph Geretz: "How do I give ASP.NET process network credentials?"
- Previous message: Rob Y: "Re: Getting aspx pages to render (have web.config)"
- In reply to: Andy: "why does this fail to run"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: ryacullo@telsource.com (Rob Y) Date: 23 Oct 2002 15:39:36 -0700
Andy,
I'm not sure if it's possible to run this from ASP.NET, but I'm
thinking it may be a permissions issue. I would set the IIS directory
permissions to not allow anonymous, and set the directory permission
to allow an account with adequate rights (ie. Administrator). Might
be worth a try, but it's just a guess.
Rob
"Andy" <a_wood20@hotmail.com> wrote in message news:<99a801c279a4$fe32e160$36ef2ecf@tkmsftngxa12>...
> Hi all,
>
> I am attempting to run a command prompt through an asp.net
> form. I am doing this through the
> system.diagnostics.process class. i know this works
> because i have it working within a VB.NET windows
> application the forms are running on a windows NT network,
> but for some reason it simply freezes the asp page, The
> commands that im trying to use are:
>
> NET USER DUMMYUSER {PASSWORD} /ADD
> EXIT
>
> The one time that it did run it gave me an error something
> along the lines of SYSTEM ERROR 5 ACCESS IS DENIED.here is
> my code:
>
> Private Sub AddUsers(ByVal Username As String, ByVal
> Password As String)
> Try
> Dim myProcess As System.Diagnostics.Process =
> New System.Diagnostics.Process()
> Dim s As String
> myProcess.StartInfo.FileName = "cmd.exe"
> myProcess.StartInfo.UseShellExecute = False
> myProcess.StartInfo.CreateNoWindow = False
> myProcess.StartInfo.RedirectStandardInput =
> True
> myProcess.StartInfo.RedirectStandardOutput =
> True
> myProcess.StartInfo.RedirectStandardError =
> True
> myProcess.Start()
> Dim sIn As StreamWriter =
> myProcess.StandardInput
> sIn.AutoFlush = True
>
> Dim sOut As StreamReader =
> myProcess.StandardOutput
> Dim sErr As StreamReader =
> myProcess.StandardError
> Response.Write(sErr.ReadToEnd.ToString
> & "<br>")
> sIn.Write("NET USER DUMMYUSER {Password} /ADD"
> & System.Environment.NewLine)
> sIn.Write("exit" & System.Environment.NewLine)
> s = sOut.ReadToEnd()
>
> If Not myProcess.HasExited Then
> myProcess.Kill()
> End If
>
> sIn.Close()
> sOut.Close()
>
> myProcess.Close()
> Response.Write(s)
> sErr.Close()
> Catch ex As Exception
> Response.Write(ex.Message & "<br>")
> End Try
>
> Any ideas
>
> thanks in advance
>
> Andy
- Next message: Joseph Geretz: "How do I give ASP.NET process network credentials?"
- Previous message: Rob Y: "Re: Getting aspx pages to render (have web.config)"
- In reply to: Andy: "why does this fail to run"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|