ActiveX DLL COM object

  • Thread starter Thread starter vbMark
  • Start date Start date
V

vbMark

When using regular, non .NET asp, I would write an ActiveX DLL COM object
in Visual Basic 6 to do all the work on the server.

Now I am using ASP.NET with C# and want to do the same. Which C# template
do I use? Where can I find information, tutorials, etc on this?

Thanks!
 
vbMark,

Do you still want to use a COM object, or do you want to create a class
library that will do the work? If you use a COM object, then you are going
to hamper the performance of your app, because you have to set ASPCompat on
the ASP.NET page to true, which locks the apartment state of the thread
doing processing.

If you just want to create a class library, then you would do it as you
would normally, and reference it in the page you want to use it in.

Hope this helps.
 
vbMark,

Do you still want to use a COM object, or do you want to create a
class
library that will do the work? If you use a COM object, then you are
going to hamper the performance of your app, because you have to set
ASPCompat on the ASP.NET page to true, which locks the apartment state
of the thread doing processing.

If you just want to create a class library, then you would do it
as you
would normally, and reference it in the page you want to use it in.

Hope this helps.

What I ultimately want to do is run a command line program from my
ASP.NET page but Process.Start keeps giving me permission errors even
though I have given full control to the world.

I don't know what you mean by "class library." I did create a class and
tried Process.Start from there but had the same problem. If you could
suggest a way to run a command line program on the server without using
Process.Start that would be great.
 
Mark,

What are the permission errors that you get? Even if you used a COM
object, you would still be running under the user that the page is being
processed under (unless you used a COM+ object, in which case you can set
the user that the object runs under).

How are you setting the user that the page is being processed under?
 
Mark,

What are the permission errors that you get? Even if you used a
COM
object, you would still be running under the user that the page is
being processed under (unless you used a COM+ object, in which case
you can set the user that the object runs under).

How are you setting the user that the page is being processed
under?

Here is the error message:
"Error saving file: System.ComponentModel.Win32Exception: Access is
denied at
System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo
startInfo) at System.Diagnostics.Process.Start() at
System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at
System.Diagnostics.Process.Start(String fileName, String arguments) at
converter.WebForm1.DoConvert(String sWorkingDir, String sFile) in
c:\inetpub\wwwroot\converter\default.aspx.cs:line 33 at
ASP.default_aspx.Button1_Click(Object Source, EventArgs e) in
http://localhost/converter/default.aspx:line 33"

What I am doing is a two step process.

1) Upload an image file (.jpg). This works fine. The file is written
to the bin directory.

2) Run a command line argument on an executable that resides in the bin
directory that converts the jpg into a gif. This is where I get the
error. If I drop to a command line and test it the process runs fine.

I right clicked on the bin directory and gave full control to ASP.NET
Machine Account and IUSR Internet Guest Account.
 
Mark,

Giving full control to the IUSR account won't do anything, because by
the time your page is processed, it is occuring in another process, and that
process is running under the ASPNET local user.

I think that the problem arises from the fact that the ASPNET account
doesn't have the rights to launch a new process, not that it doesn't have
rights to write to the directory.

As a test, go to the web.config file for the directory that the page is
in, and add the <identity> element (setting impersonate to true). Add the
name of a user that has rights to spawn a new process and see if that works.
 
Mark,

Giving full control to the IUSR account won't do anything, because
by
the time your page is processed, it is occuring in another process,
and that process is running under the ASPNET local user.

I think that the problem arises from the fact that the ASPNET
account
doesn't have the rights to launch a new process, not that it doesn't
have rights to write to the directory.

As a test, go to the web.config file for the directory that the
page is
in, and add the <identity> element (setting impersonate to true). Add
the name of a user that has rights to spawn a new process and see if
that works.

Using the <identity> element worked but I had to make the new user that I
made an Administrator. Does that sound right?
 
Mark,

There are some caveats here that you should be aware of. The first is
that all pages in that directory will run under this user profile. This
generally is not a good thing. The second is that it is an administrator.
I think that you should use a user which is not an administrator (a regular
user should do).
 
Mark,

There are some caveats here that you should be aware of. The
first is
that all pages in that directory will run under this user profile.
This generally is not a good thing. The second is that it is an
administrator. I think that you should use a user which is not an
administrator (a regular user should do).

Okay, I'll play around with it some more. Thank you for all your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top