Connecting Tech Pros Worldwide Forums | Help | Site Map

Please, Please help me

=?Utf-8?B?TWljaGFlbA==?=
Guest
 
Posts: n/a
#1: Oct 16 '07
Hello,
I am in serious need of help. I have an ASP.NET application written in C#.
I have a page that processes a file on the web server. The page uses a class
I created and stored in the AppCode directory. In the class method I am
trying to run a program on my web server that will convert the file for me.
Here is a snipit of code:

System.Diagnostics.Process proc = new System.Diagnostics.Process();

proc.StartInfo.FileName = sDir + "App_LocalResources\\FileConverter.exe";
proc.StartInfo.Arguments = "-i " + filename + "." + extension;

proc.EnableRaisingEvents = false;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;


proc.Start();
proc.WaitForExit(99999999);

if (!proc.HasExited)
proc.Kill();
proc.Close();


The problem is that as soon as my code gets to proc.Start I get an 'Access
is Denied' error. I have tried everything I could think of or find on the
web. Could someone please help me out with this?

Thank you,
Michael

Aidy
Guest
 
Posts: n/a
#2: Oct 16 '07

re: Please, Please help me


Remember that if you use anonymous authentication that the process is
running as the aspnet account which is local to the machine and has
restricted permissions. Ensure your anonymous user has the rights to do
whatever this EXE is trying to do. Also make sure it doesn't instigate any
pop-ups, message boxes etc.

"Michael" <Michael@discussions.microsoft.comwrote in message
news:1FE27502-D91A-4E9A-BFD5-E9C60682D8C6@microsoft.com...
Quote:
Hello,
I am in serious need of help. I have an ASP.NET application written in
C#.
I have a page that processes a file on the web server. The page uses a
class
I created and stored in the AppCode directory. In the class method I am
trying to run a program on my web server that will convert the file for
me.
Here is a snipit of code:
>
System.Diagnostics.Process proc = new System.Diagnostics.Process();
>
proc.StartInfo.FileName = sDir + "App_LocalResources\\FileConverter.exe";
proc.StartInfo.Arguments = "-i " + filename + "." + extension;
>
proc.EnableRaisingEvents = false;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
>
>
proc.Start();
proc.WaitForExit(99999999);
>
if (!proc.HasExited)
proc.Kill();
proc.Close();
>
>
The problem is that as soon as my code gets to proc.Start I get an 'Access
is Denied' error. I have tried everything I could think of or find on the
web. Could someone please help me out with this?
>
Thank you,
Michael

=?Utf-8?B?TWljaGFlbA==?=
Guest
 
Posts: n/a
#3: Oct 16 '07

re: Please, Please help me


Sorry Aidy,
but that does not really help. I have given permissions to all the
accounts I can think of on the app_localresources folder and the exe's as
well.
I really need someone to explain to me from beginning to end how to set this
up.

Thanks,
Michael

"Aidy" wrote:
Quote:
Remember that if you use anonymous authentication that the process is
running as the aspnet account which is local to the machine and has
restricted permissions. Ensure your anonymous user has the rights to do
whatever this EXE is trying to do. Also make sure it doesn't instigate any
pop-ups, message boxes etc.
>
"Michael" <Michael@discussions.microsoft.comwrote in message
news:1FE27502-D91A-4E9A-BFD5-E9C60682D8C6@microsoft.com...
Quote:
Hello,
I am in serious need of help. I have an ASP.NET application written in
C#.
I have a page that processes a file on the web server. The page uses a
class
I created and stored in the AppCode directory. In the class method I am
trying to run a program on my web server that will convert the file for
me.
Here is a snipit of code:

System.Diagnostics.Process proc = new System.Diagnostics.Process();

proc.StartInfo.FileName = sDir + "App_LocalResources\\FileConverter.exe";
proc.StartInfo.Arguments = "-i " + filename + "." + extension;

proc.EnableRaisingEvents = false;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;


proc.Start();
proc.WaitForExit(99999999);

if (!proc.HasExited)
proc.Kill();
proc.Close();


The problem is that as soon as my code gets to proc.Start I get an 'Access
is Denied' error. I have tried everything I could think of or find on the
web. Could someone please help me out with this?

Thank you,
Michael
>
>
>
=?Utf-8?B?S2VpdGg=?=
Guest
 
Posts: n/a
#4: Oct 16 '07

re: Please, Please help me


Try this:

In the folder the FileConverter.exe resides:
- Give "Everyone" read/write/execute access (make sure to change any other
user accounts you already have set up for that folder)

Try running it - if it works, you had a permissions issue for that folder,
but I would recommend taking out the "Everyone" account as soon as possible
and figuring out the correct ASPNET or IUSER_[MACHINE_NAME] account(s) that
need permission.

If it doesn't work, do the same for whatever folders this particular
application is accessing - it sounds like you're manipulating files, so
wherever any file reading/writing is being done, give "Everyone" read/write
access to those as well.

If this works, you had a permissions problem with that folder. If not, I'm
sorry that's all I can think of right now.

If that doesn't help you and you have control over the source for this
FileConverter.exe, figure out a way to pull the applicable routines into a
sharable class that you can use in both the FileConverter.exe and your web
app. Again you're going to need read/write permissions to the folder you're
manipulating files in, but at least it takes out the possibility that there's
a problem executing the windows app.

"Michael" wrote:
Quote:
Hello,
I am in serious need of help. I have an ASP.NET application written in C#.
I have a page that processes a file on the web server. The page uses a class
I created and stored in the AppCode directory. In the class method I am
trying to run a program on my web server that will convert the file for me.
Here is a snipit of code:
>
System.Diagnostics.Process proc = new System.Diagnostics.Process();
>
proc.StartInfo.FileName = sDir + "App_LocalResources\\FileConverter.exe";
proc.StartInfo.Arguments = "-i " + filename + "." + extension;
>
proc.EnableRaisingEvents = false;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
>
>
proc.Start();
proc.WaitForExit(99999999);
>
if (!proc.HasExited)
proc.Kill();
proc.Close();
>
>
The problem is that as soon as my code gets to proc.Start I get an 'Access
is Denied' error. I have tried everything I could think of or find on the
web. Could someone please help me out with this?
>
Thank you,
Michael
Kevin Spencer
Guest
 
Posts: n/a
#5: Oct 17 '07

re: Please, Please help me


Hi Michael,

A Security Exception can be thrown if the code that is running is not
granted the necessary Code Access security. This may refer to your web
application (which I doubt, as ASP.Net web applications are granted Full
Trust by default) or the executable that your web application is trying to
start (more likely). Check out the following articles on Code Access
Security:

Improving Web Application Security: Threats and Countermeasures
http://msdn2.microsoft.com/en-us/library/ms994921.aspx

Code Access Security in Practice
http://msdn2.microsoft.com/en-us/library/aa302424.aspx

How To: Use Code Access Security in ASP.NET 2.0
http://msdn2.microsoft.com/en-us/library/ms998326.aspx

Using Code Access Security with ASP.NET
http://msdn2.microsoft.com/en-us/library/aa302425.aspx

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Michael" <Michael@discussions.microsoft.comwrote in message
news:261EE74E-3665-435E-A6FB-FAEE6B407E1A@microsoft.com...
Quote:
Sorry Aidy,
but that does not really help. I have given permissions to all the
accounts I can think of on the app_localresources folder and the exe's as
well.
I really need someone to explain to me from beginning to end how to set
this
up.
>
Thanks,
Michael
>
"Aidy" wrote:
>
Quote:
>Remember that if you use anonymous authentication that the process is
>running as the aspnet account which is local to the machine and has
>restricted permissions. Ensure your anonymous user has the rights to do
>whatever this EXE is trying to do. Also make sure it doesn't instigate
>any
>pop-ups, message boxes etc.
>>
>"Michael" <Michael@discussions.microsoft.comwrote in message
>news:1FE27502-D91A-4E9A-BFD5-E9C60682D8C6@microsoft.com...
Quote:
Hello,
I am in serious need of help. I have an ASP.NET application written in
C#.
I have a page that processes a file on the web server. The page uses a
class
I created and stored in the AppCode directory. In the class method I
am
trying to run a program on my web server that will convert the file for
me.
Here is a snipit of code:
>
System.Diagnostics.Process proc = new System.Diagnostics.Process();
>
proc.StartInfo.FileName = sDir +
"App_LocalResources\\FileConverter.exe";
proc.StartInfo.Arguments = "-i " + filename + "." + extension;
>
proc.EnableRaisingEvents = false;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden;
>
>
proc.Start();
proc.WaitForExit(99999999);
>
if (!proc.HasExited)
proc.Kill();
proc.Close();
>
>
The problem is that as soon as my code gets to proc.Start I get an
'Access
is Denied' error. I have tried everything I could think of or find on
the
web. Could someone please help me out with this?
>
Thank you,
Michael
>>
>>
>>

=?Utf-8?B?TWljaGFlbA==?=
Guest
 
Posts: n/a
#6: Oct 17 '07

re: Please, Please help me


Kevin,
thank you so much for your help. All of that information was great, but I
could not find anything that addressed accessing an third party exe. I have
tried everthing you suggested and have not got it to work yet. It works find
while I run it locally using VS. Just not on my production server.

Michael



"Kevin Spencer" wrote:
Quote:
Hi Michael,
>
A Security Exception can be thrown if the code that is running is not
granted the necessary Code Access security. This may refer to your web
application (which I doubt, as ASP.Net web applications are granted Full
Trust by default) or the executable that your web application is trying to
start (more likely). Check out the following articles on Code Access
Security:
>
Improving Web Application Security: Threats and Countermeasures
http://msdn2.microsoft.com/en-us/library/ms994921.aspx
>
Code Access Security in Practice
http://msdn2.microsoft.com/en-us/library/aa302424.aspx
>
How To: Use Code Access Security in ASP.NET 2.0
http://msdn2.microsoft.com/en-us/library/ms998326.aspx
>
Using Code Access Security with ASP.NET
http://msdn2.microsoft.com/en-us/library/aa302425.aspx
>
--
HTH,
>
Kevin Spencer
Microsoft MVP
>
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
>
"Michael" <Michael@discussions.microsoft.comwrote in message
news:261EE74E-3665-435E-A6FB-FAEE6B407E1A@microsoft.com...
Quote:
Sorry Aidy,
but that does not really help. I have given permissions to all the
accounts I can think of on the app_localresources folder and the exe's as
well.
I really need someone to explain to me from beginning to end how to set
this
up.

Thanks,
Michael

"Aidy" wrote:
Quote:
Remember that if you use anonymous authentication that the process is
running as the aspnet account which is local to the machine and has
restricted permissions. Ensure your anonymous user has the rights to do
whatever this EXE is trying to do. Also make sure it doesn't instigate
any
pop-ups, message boxes etc.
>
"Michael" <Michael@discussions.microsoft.comwrote in message
news:1FE27502-D91A-4E9A-BFD5-E9C60682D8C6@microsoft.com...
Hello,
I am in serious need of help. I have an ASP.NET application written in
C#.
I have a page that processes a file on the web server. The page uses a
class
I created and stored in the AppCode directory. In the class method I
am
trying to run a program on my web server that will convert the file for
me.
Here is a snipit of code:

System.Diagnostics.Process proc = new System.Diagnostics.Process();

proc.StartInfo.FileName = sDir +
"App_LocalResources\\FileConverter.exe";
proc.StartInfo.Arguments = "-i " + filename + "." + extension;

proc.EnableRaisingEvents = false;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden;


proc.Start();
proc.WaitForExit(99999999);

if (!proc.HasExited)
proc.Kill();
proc.Close();


The problem is that as soon as my code gets to proc.Start I get an
'Access
is Denied' error. I have tried everything I could think of or find on
the
web. Could someone please help me out with this?

Thank you,
Michael
>
>
>
>
>
>
Closed Thread