Running VB.NET app from network

G

Guest

Hi everyone,
My coworker has a simple desktop app created in VB.NET.

He compiled it and posted on the network drive. When we try to run it from
it's network location, it generates unhandled exception error.
When we run it from local machine it runs fine.

Two things I want to get clarified.
1. Does VB.NET requires any specific namespace to be imported to run the exe
over network?

2. I can run other apps from network (Not VB.NET exe apps). Is it just the
..NET issue or more related to permissions on the network?

Any help is greatly appreciated.
Thanks,
Uday
 
G

Guest

assuming the .NET framework is on the server all you need to do is set up the
local pc to Trust the server

have a look at caspol.exe or mscorcfg.msc

and look for "trusted assemblies" in the online help

hth

guy
 
E

Eric Sabine

Toss something like this in the Main() method

Try
' Demand full trust as this application needs to be run from
' a network location
Dim fullTrust As New
PermissionSet(Permissions.PermissionState.Unrestricted)
fullTrust.Demand()
SecondaryMain() ' some other method which does other startup functions
Catch ex As SecurityException
MessageBox.Show( _
"Your .NET Framework permissions will need to be adjusted before you can
" & _
"run this application." & Environment.NewLine & _
"Please have an administrator modify your .NET Security Wizard to set "
& _
"'Local Intranet' to Full Trust.", _
"Security Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try


and in at the top of your class
Imports System.Security

This will at least handle the exception instead of leaving it unhandled. In
the Admin tools of the control panel, find the DNF wizard, click Adjust .NET
security, Next, click local intranet, and change the permissions to full
trust.

hth
Eric
 
B

Bob

Just as an aside to what the other said, I find it better to have the
executable launched locally. You can give users a shortcut to a batch file
on the server, which could copy the file locally (perhaps checking to see if
that particular version is already there first) and then launch it on the
client machine instead.

Bob
 

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