469,576 Members | 1,741 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,576 developers. It's quick & easy.

Writing an "ActiveX" control using C#

I have a dilemma, that I am hopping I can find some help with. He is the back
story so everyone sort of understands what it is that I am trying to
accomplish.

My problem:

I have multiple users, each user has 2 or more CPU’s, using 3 or more
monitors.
1 CPU system is running my web application. (Slick, high performance, and
wonderful)
1 Cpu/Dual monitor system is running 2 windows applications that allow the
user to view various images. (Java, very evil!)
I have to be able to launch 1 of the 2 windows applications via RSH, (I
don’t like it any more than you do, but it’s what I have), because the
windows programs only accept command line input. (Please don’t yell at me, I
didn’t write them, I only need to use them)
There are typically several of these “Pc sets”, (a “Pc set” for this
conversation is the Web app Pc, and the Images Pc), all of which the users
can use freely at any time.
These Pc sets are behind a firewall, which performs network address
translation. (Think your broadband wireless router and how it allows multiple
Pc’s to share the same internet connection).
Because of this firewall/Nat system, I have no way to know what the Ip
addresses of any of the users Pc’s are during run time. (This is a generic
application being used by several groups, so hard coding is not an option).

What I need:
I need to find out what the Ip Address of the Web Pc is, during run time,
from the Web Pc itself. The Http headers are not reliable, because of the
above mentioned Firewall/Nat.
I need to be able to take that IpAddress, and store it in an Oracle data
base, using a connection string defined during run time.
I need this to work with NO user intervention. Presently, project managers
are required to assign users Pc’s, and define IpAddress’s up front. This is
okay short term, and for small projects. But it won’t fly for very long.
What I have devised so far:
I have started down the road of creating what acts like an ActiveX control,
but is written using C# ( I used the article at
http://www.c-sharpcorner.com/Code/20...tiveXInNet.asp as my initial
guide to get started ).

I am loading the control with the following code inside the Html of one of
my web forms.
“<OBJECT id="ClientSystemInfo" name="ClientSystemInfo"
classid="ActiveX.dll#ActiveX.ClientSystemInfo" VIEWASTEXT />”

When this control loads, I get 2 permission errors
1. “The application attempted to perform an operation not allowed by the
security policy. To grant this application the required permission, contact
your system administrator, or use the MS.NET framework configuration tool”
2. “That assembly does not allow partially trusted callers”

I have tried messing with the framework configuration tool, but I either am
doing something wrong, or I’m just way off base, because it just doesn’t seem
to make any difference.

For a while, I would see the app work, when it was loaded from the web
server, but I could not make it work off my laptop. So, when the control
loaded, and worked, that was good, *BUT*, then I made code changes, and the
new control I just made code changes to would not download and run, ( IE
seemed to cache it, and would not pull the new one ), unless I changed my
Url. This is made debugging sort of difficult.

I have talked it over with some co-workers, and they seem to be in agreement
that this is the best, yet messiest, solution. Seems to sort of be a no-win
right now.

Limitations:
I started development with classic Asp. I then transitioned to
VB.NET/ASP.NET and I am now writing C#/Asp.NET. I have always been a web
developer, I can do windows applications, but my UI leaves something to be
desired. There doesn’t really need to be a UI here, so I am cool writing
this. I have never had the “pleasure” of writing C++ outside of school, or
any COM objects. I could learn, but I have an extremely aggressive timeline,
so taking a week or two to become proficient in a new non.NET language is not
really an option.

I would far prefer to keep this an all .NET solution if at all possible.

Thanks!!!!
Nov 18 '05 #1
0 1568

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by adam | last post: by
5 posts views Thread by Andrew | last post: by
5 posts views Thread by ESPN Lover | last post: by
3 posts views Thread by =?Utf-8?B?ZG5vcnJpcw==?= | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.