Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / June 2004

Tip: Looking for answers? Try searching our database.

Yet another Network App question (slightly different though);

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt Budd - 22 Jun 2004 18:49 GMT
Hello all,

I've looked through this newsgroup and saw lots of questions about running
an application from a network drive or a local network. I know that when you
do this, it puts the assembly into a different "zone" of trust which is more
restrictive.

In my situation this is a good thing. We don't want to allow our application
to be run over the network and want to force them to install it (and buy it)
on each local machine. The problem I'm having is that when you attempt to
run it off the network drive, it dies on you and you get a
System.Security.SecurityException unhandled exception. What I want to do is
basically catch this exception and then display a readable error message
explaining that it has to be run locally.

I've tried the following code at the very start of my Main() function:
[STAThread]
static void Main(string[] pasArgs)
{
   try {
       if
(System.Security.SecurityManager.ResolvePolicy(typeof(frmMain).Assembly.Evid
ence).IsUnrestricted() == false)  {
           MessageBox.Show("Must run locally!");
           return;
       }
   } catch (System.Security.SecurityException e) {
       MessageBox.Show(e.ToString());
       return;
   }

But I still get the exception and neither of my messageboxes show. Any ideas
how to catch this exception?

- Matt
Fernando Vicaria [MSFT] - 23 Jun 2004 23:23 GMT
Hi Matt,

You would need to demand for an identity permission here, either Zone or
Url. But this on its own is easy to fake so you should think of additional
security checks such as strong name or/and the use of an intermediate caller
assembly which will have your security checks built-in (and properly
obfuscated if necessary).

Have a look at UrlIdentityPermission and ZoneIdentityPermission.

Thanks,
Fernando

> Hello all,
>
[quoted text clipped - 37 lines]
>
> - Matt

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.