Preventing an application from being started from another computer

  • Thread starter Dennis C. Drumm
  • Start date
D

Dennis C. Drumm

Is there a way to set the security for a .net application so that it can
only be run on the machine were it is installed?

I would like to prevent users from being able to start the application by
navigating to a shared drive on the computer where the program was installed
and starting it using the shortcut or exe installed on the host computer.

thanks,

Dennis
 
N

Nicholas Paldino [.NET/C# MVP]

Dennis,

You should be able to apply the ZoneIdentityPermission attribute to the
entry point of your application. You can pass the MyComputer value from the
SecurityZone enumeration to the constructor of the attribute. Once you do
that, your application should only run when executed from the local machine.

Hope this helps.
 
M

Morten Wennevik

Hi Dennis,

Maybe you could write something to the registry during installation. When
the user tries to start the application from another system it won't find
this registry entry and fail. There might be better ways though.

Happy coding!
Morten
 
D

Dennis C. Drumm

Nicholas:

That sounds like it would work, but after doing some reading, the how of it
still escapes me! I will keep at it, but if you could provide a little more
information or an article that discusses this issue it would be greatly
appreciated.

Dennis



Nicholas Paldino said:
Dennis,

You should be able to apply the ZoneIdentityPermission attribute to the
entry point of your application. You can pass the MyComputer value from the
SecurityZone enumeration to the constructor of the attribute. Once you do
that, your application should only run when executed from the local machine.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Dennis C. Drumm said:
Is there a way to set the security for a .net application so that it can
only be run on the machine were it is installed?

I would like to prevent users from being able to start the application by
navigating to a shared drive on the computer where the program was installed
and starting it using the shortcut or exe installed on the host computer.

thanks,

Dennis
 
G

Guest

Hi Dennis,

Thank you for posting in the community!

Just as Nicholas's solution, you need just apply the
ZoneIdentityPermissionAttribute to the entire assembly like this:
[assembly:ZoneIdentityPermissionAttribute(SecurityAction.RequestMinimum
,Zone=SecurityZone.MyComputer)]

======================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
D

Dennis C. Drumm

Jeffrey:

Thanks, that is what I needed.

I'm still a little confused by the syntax though. The MSDN
documentation for the ZoneIdentityPermissionAttribute constructor only
takes one argument. The ", Zone = SecurityZone.MyComputer" in the argument
list is hanging me up.

Could you explain what is going on here. (I know this will probably turn out
to be embarrassing!)

Thanks,

Dennis
 
G

Guest

Hi Dennis,

Thanks very much for your feedback.

I am glad it works. :)

Actually, for an attribute, the first is the constructor of the attribute,
while the following fields are its properties.

If you have any further concern, please feel free to post, we will help
you. thanks.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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

Top