473,671 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to run a program from an aspx page?

Hi:

I want to run cacls.exe to check the user right from an ASPX page. In ASP, I
can do:

Set wshobj=Server.C reateObject("WS cript.Shell")
resobj=wshobj.R un("cmd /c echo Y| cacls c:", 0, True)
Set wshobj=Nothing

But I don't know how to do this in ASPX page (writen in C#).

Can anyone help me? Can you show me a simple sample or tell me some websites
that have tutorials on it?

Thanks a lot!

Q.

Nov 18 '05 #1
8 2530
System.Diagnost ics.Process.Sta rt(filename);

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:Ot******** ******@TK2MSFTN GP09.phx.gbl...
Hi:

I want to run cacls.exe to check the user right from an ASPX page. In ASP, I can do:

Set wshobj=Server.C reateObject("WS cript.Shell")
resobj=wshobj.R un("cmd /c echo Y| cacls c:", 0, True)
Set wshobj=Nothing

But I don't know how to do this in ASPX page (writen in C#).

Can anyone help me? Can you show me a simple sample or tell me some websites that have tutorials on it?

Thanks a lot!

Q.


Nov 18 '05 #2
Hi:

I tried the following code, but it didnot work and I didnot get any error
message:

Process myProcess = new Process();
myProcess.Start Info.FileName = "cmd.exe";
myProcess.Start Info.Arguments = "/C cacls D:\\inetpub >
D:\\temp\\aclTe mp.txt";
myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Hidden;
myProcess.Start Info.RedirectSt andardOutput = false;
myProcess.Start Info.CreateNoWi ndow = true ;
myProcess.Start () ;

I don't know where the problem is. Can you help me?

Thanks!

Q.
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:OT******** ******@TK2MSFTN GP15.phx.gbl...
System.Diagnost ics.Process.Sta rt(filename);

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:Ot******** ******@TK2MSFTN GP09.phx.gbl...
Hi:

I want to run cacls.exe to check the user right from an ASPX page. In
ASP,

I
can do:

Set wshobj=Server.C reateObject("WS cript.Shell")
resobj=wshobj.R un("cmd /c echo Y| cacls c:", 0, True)
Set wshobj=Nothing

But I don't know how to do this in ASPX page (writen in C#).

Can anyone help me? Can you show me a simple sample or tell me some

websites
that have tutorials on it?

Thanks a lot!

Q.



Nov 18 '05 #3
I'm not sure what you mean by "didn't work." You set up the Process to hide
its' Window, run the cmd utility and run from that a program that displays
an ACL in the Window. The Window is hidden, as per your instructions. What
did you expect to see?

Perhaps if you tell me what you're trying to accomplish by this, I can help
more.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:eg******** ******@TK2MSFTN GP12.phx.gbl...
Hi:

I tried the following code, but it didnot work and I didnot get any error
message:

Process myProcess = new Process();
myProcess.Start Info.FileName = "cmd.exe";
myProcess.Start Info.Arguments = "/C cacls D:\\inetpub >
D:\\temp\\aclTe mp.txt";
myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Hidden;
myProcess.Start Info.RedirectSt andardOutput = false;
myProcess.Start Info.CreateNoWi ndow = true ;
myProcess.Start () ;

I don't know where the problem is. Can you help me?

Thanks!

Q.
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:OT******** ******@TK2MSFTN GP15.phx.gbl...
System.Diagnost ics.Process.Sta rt(filename);

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:Ot******** ******@TK2MSFTN GP09.phx.gbl...
Hi:

I want to run cacls.exe to check the user right from an ASPX page. In
ASP,

I
can do:

Set wshobj=Server.C reateObject("WS cript.Shell")
resobj=wshobj.R un("cmd /c echo Y| cacls c:", 0, True)
Set wshobj=Nothing

But I don't know how to do this in ASPX page (writen in C#).

Can anyone help me? Can you show me a simple sample or tell me some

websites
that have tutorials on it?

Thanks a lot!

Q.




Nov 18 '05 #4
Hi, Kevin:

What I want is to get the account infomation of a certain directory, for
example d:\inetpub, from the program "cacls.exe" . In another words, I want
to know which account has what right in the directory (folder).

I just want to use the code that I sent to you to store the result of
running calcs.exe in the text file "D:\\temp\\aclT emp.txt".

But after the program ran, the aclTemp.txt is still empty (I created it
before ran the program.). So I think the piece of the codes didnot work.
BTW, the codes is in an ASPX page. However, I didnot get any error message.

Where is the problem? This is my first time to use ProcessStartInf o, so I
have no idea.

If you need more information, please let me know.

Thanks!

Qing


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:OR******** ******@TK2MSFTN GP09.phx.gbl...
I'm not sure what you mean by "didn't work." You set up the Process to
hide
its' Window, run the cmd utility and run from that a program that displays
an ACL in the Window. The Window is hidden, as per your instructions. What
did you expect to see?

Perhaps if you tell me what you're trying to accomplish by this, I can
help
more.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:eg******** ******@TK2MSFTN GP12.phx.gbl...
Hi:

I tried the following code, but it didnot work and I didnot get any error
message:

Process myProcess = new Process();
myProcess.Start Info.FileName = "cmd.exe";
myProcess.Start Info.Arguments = "/C cacls D:\\inetpub >
D:\\temp\\aclTe mp.txt";
myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Hidden;
myProcess.Start Info.RedirectSt andardOutput = false;
myProcess.Start Info.CreateNoWi ndow = true ;
myProcess.Start () ;

I don't know where the problem is. Can you help me?

Thanks!

Q.
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:OT******** ******@TK2MSFTN GP15.phx.gbl...
> System.Diagnost ics.Process.Sta rt(filename);
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
>
> "Quentin Huo" <q.***@manyworl ds.com> wrote in message
> news:Ot******** ******@TK2MSFTN GP09.phx.gbl...
>> Hi:
>>
>> I want to run cacls.exe to check the user right from an ASPX page. In
>> ASP,
> I
>> can do:
>>
>> Set wshobj=Server.C reateObject("WS cript.Shell")
>> resobj=wshobj.R un("cmd /c echo Y| cacls c:", 0, True)
>> Set wshobj=Nothing
>>
>> But I don't know how to do this in ASPX page (writen in C#).
>>
>> Can anyone help me? Can you show me a simple sample or tell me some
> websites
>> that have tutorials on it?
>>
>> Thanks a lot!
>>
>> Q.
>>
>>
>>
>>
>>
>
>



Nov 18 '05 #5
> I just want to use the code that I sent to you to store the result of
running calcs.exe in the text file "D:\\temp\\aclT emp.txt".
Not quite. If, for example, I ran into you on the street, and asked where
you were going, and you told me "to the bus stop" I would have no idea where
you were going, as the real destination is the destination you expect the
bus to take you to. So, when I ask what you're trying to accomplish, and you
tell me "to store the result of running cacls.exe in the text file..." you
haven't told me what you want to accomplish by doing that; you've only told
me how you want to accomplish it.

Now, when you say "I want to know which account has what right in the
directory" you're getting closer to what your business rule is. What do you
plan to do with that information?

The reason I ask this is that ASP uses scripting, and has very limited
funtionality and permissions, and it is often necessary with ASP to dow
"workaround s" to get information that is not normally available to
scripting. ASP.Net is a fully-compiled "real" programming technology, with
the entire resources of the Common Language Runtime Library, and anything
else you need, natively. If you could tell me what your business requirement
is (where is the bus taking you?) I can suggest a way to do it without the
klugy workarounds.

For example, you say you want to spawn an instance of the cmd.exe utility to
run another program. In fact, you could skip the cmd.exe utility altogether
and simply run the other program. But I don't think you really want to run
cacls.exe, and besides, you've got the command-line syntax wrong for what
you're trying to accomplish. It is almost never necessary to run a
shelled-out command-line to accomplish anything with .Net, but I need to
know what you want to do with this information first before I can advise
you.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:#2******** ******@tk2msftn gp13.phx.gbl... Hi, Kevin:

What I want is to get the account infomation of a certain directory, for
example d:\inetpub, from the program "cacls.exe" . In another words, I want
to know which account has what right in the directory (folder).

I just want to use the code that I sent to you to store the result of
running calcs.exe in the text file "D:\\temp\\aclT emp.txt".

But after the program ran, the aclTemp.txt is still empty (I created it
before ran the program.). So I think the piece of the codes didnot work.
BTW, the codes is in an ASPX page. However, I didnot get any error message.
Where is the problem? This is my first time to use ProcessStartInf o, so I
have no idea.

If you need more information, please let me know.

Thanks!

Qing


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:OR******** ******@TK2MSFTN GP09.phx.gbl...
I'm not sure what you mean by "didn't work." You set up the Process to
hide
its' Window, run the cmd utility and run from that a program that displays an ACL in the Window. The Window is hidden, as per your instructions. What did you expect to see?

Perhaps if you tell me what you're trying to accomplish by this, I can
help
more.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:eg******** ******@TK2MSFTN GP12.phx.gbl...
Hi:

I tried the following code, but it didnot work and I didnot get any error message:

Process myProcess = new Process();
myProcess.Start Info.FileName = "cmd.exe";
myProcess.Start Info.Arguments = "/C cacls D:\\inetpub >
D:\\temp\\aclTe mp.txt";
myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Hidden;
myProcess.Start Info.RedirectSt andardOutput = false;
myProcess.Start Info.CreateNoWi ndow = true ;
myProcess.Start () ;

I don't know where the problem is. Can you help me?

Thanks!

Q.
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:OT******** ******@TK2MSFTN GP15.phx.gbl...
> System.Diagnost ics.Process.Sta rt(filename);
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
>
> "Quentin Huo" <q.***@manyworl ds.com> wrote in message
> news:Ot******** ******@TK2MSFTN GP09.phx.gbl...
>> Hi:
>>
>> I want to run cacls.exe to check the user right from an ASPX page. In >> ASP,
> I
>> can do:
>>
>> Set wshobj=Server.C reateObject("WS cript.Shell")
>> resobj=wshobj.R un("cmd /c echo Y| cacls c:", 0, True)
>> Set wshobj=Nothing
>>
>> But I don't know how to do this in ASPX page (writen in C#).
>>
>> Can anyone help me? Can you show me a simple sample or tell me some
> websites
>> that have tutorials on it?
>>
>> Thanks a lot!
>>
>> Q.
>>
>>
>>
>>
>>
>
>



Nov 18 '05 #6
Hi:

I want to control the access right to some resources in my computer by
control the ACLs. For example, I don't want everybody can access files in my
some folders. So I will give different users with different rights: some can
only read and some can write. And I may have to change the rights of some
users sometimes.

cacls is a program to change or modify the ACLs. for example:

cacls myfile.txt /e /g mrhope:f

it means Grants the user "mrhope" full rights to the myfile.txt file

cacls runs under the command line, so I need to "spawn an instance of the
cmd.exe utility" to
run it.

Thanks

Q.

"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I just want to use the code that I sent to you to store the result of
running calcs.exe in the text file "D:\\temp\\aclT emp.txt".


Not quite. If, for example, I ran into you on the street, and asked where
you were going, and you told me "to the bus stop" I would have no idea
where
you were going, as the real destination is the destination you expect the
bus to take you to. So, when I ask what you're trying to accomplish, and
you
tell me "to store the result of running cacls.exe in the text file..." you
haven't told me what you want to accomplish by doing that; you've only
told
me how you want to accomplish it.

Now, when you say "I want to know which account has what right in the
directory" you're getting closer to what your business rule is. What do
you
plan to do with that information?

The reason I ask this is that ASP uses scripting, and has very limited
funtionality and permissions, and it is often necessary with ASP to dow
"workaround s" to get information that is not normally available to
scripting. ASP.Net is a fully-compiled "real" programming technology, with
the entire resources of the Common Language Runtime Library, and anything
else you need, natively. If you could tell me what your business
requirement
is (where is the bus taking you?) I can suggest a way to do it without the
klugy workarounds.

For example, you say you want to spawn an instance of the cmd.exe utility
to
run another program. In fact, you could skip the cmd.exe utility
altogether
and simply run the other program. But I don't think you really want to run
cacls.exe, and besides, you've got the command-line syntax wrong for what
you're trying to accomplish. It is almost never necessary to run a
shelled-out command-line to accomplish anything with .Net, but I need to
know what you want to do with this information first before I can advise
you.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:#2******** ******@tk2msftn gp13.phx.gbl...
Hi, Kevin:

What I want is to get the account infomation of a certain directory, for
example d:\inetpub, from the program "cacls.exe" . In another words, I
want
to know which account has what right in the directory (folder).

I just want to use the code that I sent to you to store the result of
running calcs.exe in the text file "D:\\temp\\aclT emp.txt".

But after the program ran, the aclTemp.txt is still empty (I created it
before ran the program.). So I think the piece of the codes didnot work.
BTW, the codes is in an ASPX page. However, I didnot get any error

message.

Where is the problem? This is my first time to use ProcessStartInf o, so I
have no idea.

If you need more information, please let me know.

Thanks!

Qing


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:OR******** ******@TK2MSFTN GP09.phx.gbl...
> I'm not sure what you mean by "didn't work." You set up the Process to
> hide
> its' Window, run the cmd utility and run from that a program that displays > an ACL in the Window. The Window is hidden, as per your instructions. What > did you expect to see?
>
> Perhaps if you tell me what you're trying to accomplish by this, I can
> help
> more.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
>
> "Quentin Huo" <q.***@manyworl ds.com> wrote in message
> news:eg******** ******@TK2MSFTN GP12.phx.gbl...
>> Hi:
>>
>> I tried the following code, but it didnot work and I didnot get any error >> message:
>>
>> Process myProcess = new Process();
>> myProcess.Start Info.FileName = "cmd.exe";
>> myProcess.Start Info.Arguments = "/C cacls D:\\inetpub >
>> D:\\temp\\aclTe mp.txt";
>> myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Hidden;
>> myProcess.Start Info.RedirectSt andardOutput = false;
>> myProcess.Start Info.CreateNoWi ndow = true ;
>> myProcess.Start () ;
>>
>> I don't know where the problem is. Can you help me?
>>
>> Thanks!
>>
>> Q.
>>
>>
>> "Kevin Spencer" <ks******@takem pis.com> wrote in message
>> news:OT******** ******@TK2MSFTN GP15.phx.gbl...
>> > System.Diagnost ics.Process.Sta rt(filename);
>> >
>> > --
>> > HTH,
>> > Kevin Spencer
>> > .Net Developer
>> > Microsoft MVP
>> > Neither a follower
>> > nor a lender be.
>> >
>> > "Quentin Huo" <q.***@manyworl ds.com> wrote in message
>> > news:Ot******** ******@TK2MSFTN GP09.phx.gbl...
>> >> Hi:
>> >>
>> >> I want to run cacls.exe to check the user right from an ASPX page. In >> >> ASP,
>> > I
>> >> can do:
>> >>
>> >> Set wshobj=Server.C reateObject("WS cript.Shell")
>> >> resobj=wshobj.R un("cmd /c echo Y| cacls c:", 0, True)
>> >> Set wshobj=Nothing
>> >>
>> >> But I don't know how to do this in ASPX page (writen in C#).
>> >>
>> >> Can anyone help me? Can you show me a simple sample or tell me some
>> > websites
>> >> that have tutorials on it?
>> >>
>> >> Thanks a lot!
>> >>
>> >> Q.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 18 '05 #7
Okay, now I'm REALLY confused. You ARE writing an ASP.Net application,
correct? If so, you should know that the application runs under ONE user
account only, not under any user accounts that belong to people using client
browsers. So, I have no idea how you're supposed to control access to that
file by setting file permissions on it.

There are classes in the CLR that enable you to grant and deny users
permissions to files. But again, I'm not seeing the logic of your method.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:OP******** ******@TK2MSFTN GP15.phx.gbl...
Hi:

I want to control the access right to some resources in my computer by
control the ACLs. For example, I don't want everybody can access files in my some folders. So I will give different users with different rights: some can only read and some can write. And I may have to change the rights of some
users sometimes.

cacls is a program to change or modify the ACLs. for example:

cacls myfile.txt /e /g mrhope:f

it means Grants the user "mrhope" full rights to the myfile.txt file

cacls runs under the command line, so I need to "spawn an instance of the
cmd.exe utility" to
run it.

Thanks

Q.

"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I just want to use the code that I sent to you to store the result of
running calcs.exe in the text file "D:\\temp\\aclT emp.txt".


Not quite. If, for example, I ran into you on the street, and asked where you were going, and you told me "to the bus stop" I would have no idea
where
you were going, as the real destination is the destination you expect the bus to take you to. So, when I ask what you're trying to accomplish, and
you
tell me "to store the result of running cacls.exe in the text file..." you haven't told me what you want to accomplish by doing that; you've only
told
me how you want to accomplish it.

Now, when you say "I want to know which account has what right in the
directory" you're getting closer to what your business rule is. What do
you
plan to do with that information?

The reason I ask this is that ASP uses scripting, and has very limited
funtionality and permissions, and it is often necessary with ASP to dow
"workaround s" to get information that is not normally available to
scripting. ASP.Net is a fully-compiled "real" programming technology, with the entire resources of the Common Language Runtime Library, and anything else you need, natively. If you could tell me what your business
requirement
is (where is the bus taking you?) I can suggest a way to do it without the klugy workarounds.

For example, you say you want to spawn an instance of the cmd.exe utility to
run another program. In fact, you could skip the cmd.exe utility
altogether
and simply run the other program. But I don't think you really want to run cacls.exe, and besides, you've got the command-line syntax wrong for what you're trying to accomplish. It is almost never necessary to run a
shelled-out command-line to accomplish anything with .Net, but I need to
know what you want to do with this information first before I can advise
you.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:#2******** ******@tk2msftn gp13.phx.gbl...
Hi, Kevin:

What I want is to get the account infomation of a certain directory, for example d:\inetpub, from the program "cacls.exe" . In another words, I
want
to know which account has what right in the directory (folder).

I just want to use the code that I sent to you to store the result of
running calcs.exe in the text file "D:\\temp\\aclT emp.txt".

But after the program ran, the aclTemp.txt is still empty (I created it
before ran the program.). So I think the piece of the codes didnot work. BTW, the codes is in an ASPX page. However, I didnot get any error

message.

Where is the problem? This is my first time to use ProcessStartInf o, so I have no idea.

If you need more information, please let me know.

Thanks!

Qing


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:OR******** ******@TK2MSFTN GP09.phx.gbl...
> I'm not sure what you mean by "didn't work." You set up the Process to > hide
> its' Window, run the cmd utility and run from that a program that

displays
> an ACL in the Window. The Window is hidden, as per your instructions.

What
> did you expect to see?
>
> Perhaps if you tell me what you're trying to accomplish by this, I can > help
> more.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
>
> "Quentin Huo" <q.***@manyworl ds.com> wrote in message
> news:eg******** ******@TK2MSFTN GP12.phx.gbl...
>> Hi:
>>
>> I tried the following code, but it didnot work and I didnot get any

error
>> message:
>>
>> Process myProcess = new Process();
>> myProcess.Start Info.FileName = "cmd.exe";
>> myProcess.Start Info.Arguments = "/C cacls D:\\inetpub >
>> D:\\temp\\aclTe mp.txt";
>> myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Hidden;
>> myProcess.Start Info.RedirectSt andardOutput = false;
>> myProcess.Start Info.CreateNoWi ndow = true ;
>> myProcess.Start () ;
>>
>> I don't know where the problem is. Can you help me?
>>
>> Thanks!
>>
>> Q.
>>
>>
>> "Kevin Spencer" <ks******@takem pis.com> wrote in message
>> news:OT******** ******@TK2MSFTN GP15.phx.gbl...
>> > System.Diagnost ics.Process.Sta rt(filename);
>> >
>> > --
>> > HTH,
>> > Kevin Spencer
>> > .Net Developer
>> > Microsoft MVP
>> > Neither a follower
>> > nor a lender be.
>> >
>> > "Quentin Huo" <q.***@manyworl ds.com> wrote in message
>> > news:Ot******** ******@TK2MSFTN GP09.phx.gbl...
>> >> Hi:
>> >>
>> >> I want to run cacls.exe to check the user right from an ASPX page.
In
>> >> ASP,
>> > I
>> >> can do:
>> >>
>> >> Set wshobj=Server.C reateObject("WS cript.Shell")
>> >> resobj=wshobj.R un("cmd /c echo Y| cacls c:", 0, True)
>> >> Set wshobj=Nothing
>> >>
>> >> But I don't know how to do this in ASPX page (writen in C#).
>> >>
>> >> Can anyone help me? Can you show me a simple sample or tell me

some >> > websites
>> >> that have tutorials on it?
>> >>
>> >> Thanks a lot!
>> >>
>> >> Q.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 18 '05 #8
Hi:

OK, let me make it easier:

I want to run a command under the command line:

cacls D:\\inetpub > D:\\aclResult.t xt

Can you tell me how to do this by using System.Diagnost ics.Process.Sta rt?

Thanks

Q.
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:OS******** ******@TK2MSFTN GP15.phx.gbl...
Okay, now I'm REALLY confused. You ARE writing an ASP.Net application,
correct? If so, you should know that the application runs under ONE user
account only, not under any user accounts that belong to people using
client
browsers. So, I have no idea how you're supposed to control access to that
file by setting file permissions on it.

There are classes in the CLR that enable you to grant and deny users
permissions to files. But again, I'm not seeing the logic of your method.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Quentin Huo" <q.***@manyworl ds.com> wrote in message
news:OP******** ******@TK2MSFTN GP15.phx.gbl...
Hi:

I want to control the access right to some resources in my computer by
control the ACLs. For example, I don't want everybody can access files in

my
some folders. So I will give different users with different rights: some

can
only read and some can write. And I may have to change the rights of some
users sometimes.

cacls is a program to change or modify the ACLs. for example:

cacls myfile.txt /e /g mrhope:f

it means Grants the user "mrhope" full rights to the myfile.txt file

cacls runs under the command line, so I need to "spawn an instance of the
cmd.exe utility" to
run it.

Thanks

Q.

"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
>> I just want to use the code that I sent to you to store the result of
>> running calcs.exe in the text file "D:\\temp\\aclT emp.txt".
>
> Not quite. If, for example, I ran into you on the street, and asked where > you were going, and you told me "to the bus stop" I would have no idea
> where
> you were going, as the real destination is the destination you expect the > bus to take you to. So, when I ask what you're trying to accomplish,
> and
> you
> tell me "to store the result of running cacls.exe in the text file..." you > haven't told me what you want to accomplish by doing that; you've only
> told
> me how you want to accomplish it.
>
> Now, when you say "I want to know which account has what right in the
> directory" you're getting closer to what your business rule is. What do
> you
> plan to do with that information?
>
> The reason I ask this is that ASP uses scripting, and has very limited
> funtionality and permissions, and it is often necessary with ASP to dow
> "workaround s" to get information that is not normally available to
> scripting. ASP.Net is a fully-compiled "real" programming technology, with > the entire resources of the Common Language Runtime Library, and anything > else you need, natively. If you could tell me what your business
> requirement
> is (where is the bus taking you?) I can suggest a way to do it without the > klugy workarounds.
>
> For example, you say you want to spawn an instance of the cmd.exe utility > to
> run another program. In fact, you could skip the cmd.exe utility
> altogether
> and simply run the other program. But I don't think you really want to run > cacls.exe, and besides, you've got the command-line syntax wrong for what > you're trying to accomplish. It is almost never necessary to run a
> shelled-out command-line to accomplish anything with .Net, but I need
> to
> know what you want to do with this information first before I can
> advise
> you.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
>
>
> "Quentin Huo" <q.***@manyworl ds.com> wrote in message
> news:#2******** ******@tk2msftn gp13.phx.gbl...
>> Hi, Kevin:
>>
>> What I want is to get the account infomation of a certain directory, for >> example d:\inetpub, from the program "cacls.exe" . In another words, I
>> want
>> to know which account has what right in the directory (folder).
>>
>> I just want to use the code that I sent to you to store the result of
>> running calcs.exe in the text file "D:\\temp\\aclT emp.txt".
>>
>> But after the program ran, the aclTemp.txt is still empty (I created
>> it
>> before ran the program.). So I think the piece of the codes didnot work. >> BTW, the codes is in an ASPX page. However, I didnot get any error
> message.
>>
>> Where is the problem? This is my first time to use ProcessStartInf o,
>> so I >> have no idea.
>>
>> If you need more information, please let me know.
>>
>> Thanks!
>>
>> Qing
>>
>>
>>
>>
>> "Kevin Spencer" <ks******@takem pis.com> wrote in message
>> news:OR******** ******@TK2MSFTN GP09.phx.gbl...
>> > I'm not sure what you mean by "didn't work." You set up the Process to >> > hide
>> > its' Window, run the cmd utility and run from that a program that
> displays
>> > an ACL in the Window. The Window is hidden, as per your
>> > instructions.
> What
>> > did you expect to see?
>> >
>> > Perhaps if you tell me what you're trying to accomplish by this, I can >> > help
>> > more.
>> >
>> > --
>> > HTH,
>> > Kevin Spencer
>> > .Net Developer
>> > Microsoft MVP
>> > Neither a follower
>> > nor a lender be.
>> >
>> > "Quentin Huo" <q.***@manyworl ds.com> wrote in message
>> > news:eg******** ******@TK2MSFTN GP12.phx.gbl...
>> >> Hi:
>> >>
>> >> I tried the following code, but it didnot work and I didnot get any
> error
>> >> message:
>> >>
>> >> Process myProcess = new Process();
>> >> myProcess.Start Info.FileName = "cmd.exe";
>> >> myProcess.Start Info.Arguments = "/C cacls D:\\inetpub >
>> >> D:\\temp\\aclTe mp.txt";
>> >> myProcess.Start Info.WindowStyl e = ProcessWindowSt yle.Hidden;
>> >> myProcess.Start Info.RedirectSt andardOutput = false;
>> >> myProcess.Start Info.CreateNoWi ndow = true ;
>> >> myProcess.Start () ;
>> >>
>> >> I don't know where the problem is. Can you help me?
>> >>
>> >> Thanks!
>> >>
>> >> Q.
>> >>
>> >>
>> >> "Kevin Spencer" <ks******@takem pis.com> wrote in message
>> >> news:OT******** ******@TK2MSFTN GP15.phx.gbl...
>> >> > System.Diagnost ics.Process.Sta rt(filename);
>> >> >
>> >> > --
>> >> > HTH,
>> >> > Kevin Spencer
>> >> > .Net Developer
>> >> > Microsoft MVP
>> >> > Neither a follower
>> >> > nor a lender be.
>> >> >
>> >> > "Quentin Huo" <q.***@manyworl ds.com> wrote in message
>> >> > news:Ot******** ******@TK2MSFTN GP09.phx.gbl...
>> >> >> Hi:
>> >> >>
>> >> >> I want to run cacls.exe to check the user right from an ASPX page. > In
>> >> >> ASP,
>> >> > I
>> >> >> can do:
>> >> >>
>> >> >> Set wshobj=Server.C reateObject("WS cript.Shell")
>> >> >> resobj=wshobj.R un("cmd /c echo Y| cacls c:", 0, True)
>> >> >> Set wshobj=Nothing
>> >> >>
>> >> >> But I don't know how to do this in ASPX page (writen in C#).
>> >> >>
>> >> >> Can anyone help me? Can you show me a simple sample or tell me some >> >> > websites
>> >> >> that have tutorials on it?
>> >> >>
>> >> >> Thanks a lot!
>> >> >>
>> >> >> Q.
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 18 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1274
by: Jim Heavey | last post by:
I am tyring to figure out why a class that I am trying to instatiate can not be found. I am NOT WORKING WITH PRE_COMPILED code. I am dragging the source code over and placing the code in a folder. I make the appropriate changes in my @Page directive to ensure that the program would be compiled on the fly ("src="myProgram.aspx"). All works perfectly fine until I get to one of the pages with instatiates a "utility" class that I created...
1
1181
by: Hartmut Schroth | last post by:
Hello, I want to set the title of an aspx-page by program (from a localized ressource). Data binding in the HTML code like <title><%# SomeMethodCall() %></title> doesn't work. I have not found a method yet, to access the title property of a page by code. Does anybody know how? Thanks Hartmut
0
1338
by: joeted | last post by:
Hi, I am using system.diagnostic.process with the intention of running a program to communicate with a unix box: The program is "PuTTY", running from a batch script. I know it works because if i manually trigger the batch, the results can be seen on the unix side. Running the batch script from an .aspx page however makes the process
2
1999
by: WJ | last post by:
I have three ASPX pages: 1. "WebForm1.aspx" is interactive, responsible for calling a web site (https://www.payMe.com) with $$$. It is working fine. 2. "WebForm2.aspx" is non-interactive, a listener in my site to capture a "STATUS_CD" returned by www.payMe.com. It is working fine. 3. "WebForm3.aspx" is interactive page, responsibe to display the STATUS CODE "POSTED" by "WebForm2.aspx". 4. My goal is to use "WebForm2.aspx" to call...
2
2574
by: junlia | last post by:
Hi All, I am working on a project that acts as a bridge. It does some checking with post xml data, and then redirects the request to an appropriate page. However, we find that depends on the browser cache setting (and OS), the program behaves differently. This is how it should work: 1. The client program opens a webbrowser control, using navigate2 method to post xml data to my aspx pages, eg abc.aspx
2
1226
by: Jack | last post by:
To whom may concern: 1. Web.config <authentication mode="Forms"> <forms name=".Portal" protection="All" timeout="3600" loginUrl="Login.aspx" /> </authentication> 2. The "Login.aspx" is in root of a virtual path, but I'm visiting a sub path, and now session lost, so program will redirect to login page,
10
2429
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and load as a 3rd partial class. This would be handy so i can generate standard code into one of the partial classes, while having my custom code untouched
6
1567
by: André | last post by:
Hi, I made a webform for a survey, with multiple-choice questions. The results of each question is put into a table e.g.: values frequency 1 6 2 3 3 32 4 26 5 12
13
3544
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains some javascript code that calls window.open. I pass the resource url of page B to Page A's window.open call. Page B is then loaded and executed but none of the server-side code is rendered. If I view the source of the page, the code (and page...
0
8823
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8672
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7441
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6234
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4412
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.