M
Martin
Ok, this is a challenge to the gurus out there - I thought I was a
guru too, but cannot get this to work for the life of me, so, a 6-pack
of beers to the first person who can help!
I have an existing Windows.Forms.Usercontrol. This control is an
emulator for a portable device my company uses in it's factories and
warehouses. The control connects to a domain SQL Server and carries
out read and write operations on the database.
The usercontrol is currently hosted in a Windows application on a
windows form.
What I need to do is to host the control on a webpage, so that users
can access it through the intranet. The control must be a client-side
control, and will only be available on the company intranet.
So, I've managed to host the control in a webpage succesfully using
the object tag:
<Object Classid="http://myServer/myEmulator.dll#Controls.Emulator>
This all works ok, and the control displays.
However, when the control attempts to connect to the SQL Server, it
fails due to a security exception.
Fair enough, I understand why that's happening. The framework is
limiting access to local system resources to stop malicious code being
executed.
First thing I tried was to add my site to the Trusted sites list -
this had zero effect!
The next thing I tried, was impersonation. Using the LogonUser api, I
attempted to logon the control to a domain user account, and run it
under those credentials. Unfortunately, the framework security does
not allow access to the LogonUser api call!
My final attempt - which I thought MUST work - was to move all the
database functionality out into a webservice, and use this webservice
object from the existing usercontrol. Unfortunately, this didn't work
either - I get a security exception when connecting to the webservice
- apparently this is denied as well.
I know I could rewrite the control as a webcontrol, but that would
really be re-inventing the wheel. Am I being naive in thinking that
there must be a way to reuse my existing component?
Any help at all on this - even if it's to tell me I'm being a moron -
will be greatly appreciated!
Martin
guru too, but cannot get this to work for the life of me, so, a 6-pack
of beers to the first person who can help!
I have an existing Windows.Forms.Usercontrol. This control is an
emulator for a portable device my company uses in it's factories and
warehouses. The control connects to a domain SQL Server and carries
out read and write operations on the database.
The usercontrol is currently hosted in a Windows application on a
windows form.
What I need to do is to host the control on a webpage, so that users
can access it through the intranet. The control must be a client-side
control, and will only be available on the company intranet.
So, I've managed to host the control in a webpage succesfully using
the object tag:
<Object Classid="http://myServer/myEmulator.dll#Controls.Emulator>
This all works ok, and the control displays.
However, when the control attempts to connect to the SQL Server, it
fails due to a security exception.
Fair enough, I understand why that's happening. The framework is
limiting access to local system resources to stop malicious code being
executed.
First thing I tried was to add my site to the Trusted sites list -
this had zero effect!
The next thing I tried, was impersonation. Using the LogonUser api, I
attempted to logon the control to a domain user account, and run it
under those credentials. Unfortunately, the framework security does
not allow access to the LogonUser api call!
My final attempt - which I thought MUST work - was to move all the
database functionality out into a webservice, and use this webservice
object from the existing usercontrol. Unfortunately, this didn't work
either - I get a security exception when connecting to the webservice
- apparently this is denied as well.
I know I could rewrite the control as a webcontrol, but that would
really be re-inventing the wheel. Am I being naive in thinking that
there must be a way to reuse my existing component?
Any help at all on this - even if it's to tell me I'm being a moron -
will be greatly appreciated!
Martin