By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,022 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Please, Please help me

P: n/a
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
Oct 16 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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" <Mi*****@discussions.microsoft.comwrote in message
news:1F**********************************@microsof t.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

Oct 16 '07 #2

P: n/a
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:
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" <Mi*****@discussions.microsoft.comwrote in message
news:1F**********************************@microsof t.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


Oct 16 '07 #3

P: n/a
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:
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
Oct 16 '07 #4

P: n/a
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" <Mi*****@discussions.microsoft.comwrote in message
news:26**********************************@microsof t.com...
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:
>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" <Mi*****@discussions.microsoft.comwrote in message
news:1F**********************************@microso ft.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



Oct 17 '07 #5

P: n/a
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:
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" <Mi*****@discussions.microsoft.comwrote in message
news:26**********************************@microsof t.com...
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:
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" <Mi*****@discussions.microsoft.comwrote in message
news:1F**********************************@microsof t.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


Oct 17 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.