Tuesday, May 12, 2009

How to get application specific security permission for application running on local area network or shared drive in .net framework?

application running from network need to have security permission from local machine before having access to any of the resource of it otherwise security exception is thrown, to avoid this application needs to accuire security permission as discussed here.

To target a particular application for security permission we need to add a code group with fulltrust targeting to the url pointing to the application.
This security setting could be done manually by using .net framework configuration tool shipped with SDK (mscorcfg.msc) or by caspol.exe framework tool.

Configuring with the .net framework configuration tool.

1. Control panel> Addministrative tools> Microsoft .NET Framework 2.0 Configuration tool.
2. In this tool browse to My Computer > Runtime Security >Machine>Code groups>All Codes.
3. right click on all codes > New..
4. give name to Code Group, click next
5. Choose Condition Type to URL
6. In URL field specify URL to your Application (e.g. ftp://folder/application.exe, shared drive z:// application.exe etc.)
7. click next and finish.

Configuring with caspol.exe tool
1. Press Cltr+R, type CMD
2. go to dir c:/Windows/Microsoft .Net/Framework/V2.0.50722
3. type following command > caspol.exe –addgroup 1 –url “Z://application.exe” FullTrust –name “codegroupName”

No comments:

Post a Comment