My application object is nothing on a network drive

  • Thread starter Thread starter NICOLAS Julien
  • Start date Start date
N

NICOLAS Julien

Hello,

I have a dotnet dll file.
This dll is to use MS Project by VB.

When I am launching my application from a local drive (c:\mylocapp) : no
problem

The Problem is when I am trying to launch my application from a network
drive : my "W:" is "\\Server\Testappli"


I am using this code :

public function CreateProject(byval pstr_ProjName as string) as string
On Error Resume Next
Err.Clear()
MSPapp = GetObject(, "MSProject.Application")
If Err.Number <> 0 Then
Err.Clear()
MSPapp = New MSProject.Application
End If
If IsNothing(MSPapp) Then
CreateProject = "FALSE¤CREATION"
End If

...etc

end function


if I use the debugger, MSPapp is nothing... I can not understand the
problem...

Please help me...

Thank you.


JULIEN.
 
Assume you are talking Windows Form App, and you have done necessary
security setting changes that allows your Windows app can be loaded from a
network share (by default, .NET windows app is not allowed to run from a
network share).

From what I see, at least you did not handle possible exception at

MSPapp = New MSProject.Application

That means, if this line od code cannot create "MSPrioject.Application"
object, the routine will go on (since On Error Resume Next instruction), and
you will get Nothing for MSProject. So, the code just did what you expect it
doing correctly. As for why MSPapp = New MSProject.Application not working,
I do not know (bad reference, maybe?).

However, since you mentioned it works from local drive, not from network
drive, I suspect that the function you though causing problem may not be the
source of problem, it is the security thing + a general "On Error Resume
Next" on the higher level causes problem and the code in the function did
not get run at all. By the way, why on the earth do you use "On Error Resume
Next", instead of more powerful "Try...Catch..."?
 
Hi Norman,

Yes, my dll file is using by a window form application (1 form with 1 button
to test my createproject function)

I think the security setting is the problem because before using the
function On Error Resume Next, I had a security error message from the
mscorlib.dll.

So how can I autorize my application to run from a network drive ? How can I
change the security of the mscorlib.dll ?

Please help me...

Julien.
 
Go to "Control Panel -> Administrative Tools -> Microsoft .NET Framework 1.1
[1.0] Configuration" to configure security settings. The simplest way is to
give "Local Intranet" zone full trust by highlighting "My Computer->Runtime
Security Policy" node on the left and clicking "Adjust Zone Security" link
on the right side. Warning: this adjustment is a bit risky and not
recommended unless you have very small network and you have controls on the
security of the network. Better approach is to create a code group and give
required security settings to that code group. You need to explore more on
this topic once you get your app running.
 
Hi Norman,

You are right for the MS .NET security setting, I was find this way and I
prefer to configure security just for my assembly.
The problem is : I need to do this automatically in my installation
procedure.... but I don't know how to do this !
May I do it by launching the MS .NET security assistant in silent mode... if
this mode is existing...

So for instance I have no way to do it automatically.

If you have some clues....

Thank you.

Julien.


Norman Yuan said:
Go to "Control Panel -> Administrative Tools -> Microsoft .NET Framework
1.1
[1.0] Configuration" to configure security settings. The simplest way is
to
give "Local Intranet" zone full trust by highlighting "My
Computer->Runtime
Security Policy" node on the left and clicking "Adjust Zone Security" link
on the right side. Warning: this adjustment is a bit risky and not
recommended unless you have very small network and you have controls on
the
security of the network. Better approach is to create a code group and
give
required security settings to that code group. You need to explore more on
this topic once you get your app running.

NICOLAS Julien said:
Hi Norman,

Yes, my dll file is using by a window form application (1 form with 1 button
to test my createproject function)

I think the security setting is the problem because before using the
function On Error Resume Next, I had a security error message from the
mscorlib.dll.

So how can I autorize my application to run from a network drive ? How
can I
change the security of the mscorlib.dll ?

Please help me...

Julien.
 
I do not know or bother to find an automatical way to configure local
intranet security for a .NET Windows app. My stratage is:

1. If the Windows app is complicated enough, I would create a setup project
that produce an installation package, so that the Windows app is installed
on each running computer. Therefore, there is no security problem (of
running code from outside of a computer).

2. I often have a bunch of small .NET Windows apps used in my office. Snce
they are either short lived, or subject to modification fairly often, I
would rather place them on a network share. In this case, I go to each
computer in the office and use .NET Framework configuration panel to to the
security configurayion once for all: creating a full trusted code group, and
pointing it a folder on the network share. Now, whenenver I have a new .NET
Windows app that I want to place it on network share, I just drop it into
that folder. I only give myslef write permission to that folder, everyone
else can only read and execute from that folder. So that no code can be run
from that folder without my acknowledge. Note, the .NET framework
configuration for code running from local intranet only need to be done once
(I make it into the check list of our standard computer setup procedure).

Julien NICOLAS said:
Hi Norman,

You are right for the MS .NET security setting, I was find this way and I
prefer to configure security just for my assembly.
The problem is : I need to do this automatically in my installation
procedure.... but I don't know how to do this !
May I do it by launching the MS .NET security assistant in silent mode... if
this mode is existing...

So for instance I have no way to do it automatically.

If you have some clues....

Thank you.

Julien.


Norman Yuan said:
Go to "Control Panel -> Administrative Tools -> Microsoft .NET Framework
1.1
[1.0] Configuration" to configure security settings. The simplest way is
to
give "Local Intranet" zone full trust by highlighting "My
Computer->Runtime
Security Policy" node on the left and clicking "Adjust Zone Security" link
on the right side. Warning: this adjustment is a bit risky and not
recommended unless you have very small network and you have controls on
the
security of the network. Better approach is to create a code group and
give
required security settings to that code group. You need to explore more on
this topic once you get your app running.

NICOLAS Julien said:
Hi Norman,

Yes, my dll file is using by a window form application (1 form with 1 button
to test my createproject function)

I think the security setting is the problem because before using the
function On Error Resume Next, I had a security error message from the
mscorlib.dll.

So how can I autorize my application to run from a network drive ? How
can I
change the security of the mscorlib.dll ?

Please help me...

Julien.


"Norman Yuan" <[email protected]> a écrit dans le message de (e-mail address removed)...
Assume you are talking Windows Form App, and you have done necessary
security setting changes that allows your Windows app can be loaded
from a
network share (by default, .NET windows app is not allowed to run from
a
network share).

From what I see, at least you did not handle possible exception at

MSPapp = New MSProject.Application

That means, if this line od code cannot create "MSPrioject.Application"
object, the routine will go on (since On Error Resume Next
instruction),
and
you will get Nothing for MSProject. So, the code just did what you expect
it
doing correctly. As for why MSPapp = New MSProject.Application not
working,
I do not know (bad reference, maybe?).

However, since you mentioned it works from local drive, not from
network
drive, I suspect that the function you though causing problem may not
be
the
source of problem, it is the security thing + a general "On Error
Resume
Next" on the higher level causes problem and the code in the function did
not get run at all. By the way, why on the earth do you use "On Error
Resume
Next", instead of more powerful "Try...Catch..."?

Hello,

I have a dotnet dll file.
This dll is to use MS Project by VB.

When I am launching my application from a local drive (c:\mylocapp)
:
no
problem

The Problem is when I am trying to launch my application from a
network
drive : my "W:" is "\\Server\Testappli"


I am using this code :

public function CreateProject(byval pstr_ProjName as string) as string
On Error Resume Next
Err.Clear()
MSPapp = GetObject(, "MSProject.Application")
If Err.Number <> 0 Then
Err.Clear()
MSPapp = New MSProject.Application
End If
If IsNothing(MSPapp) Then
CreateProject = "FALSE¤CREATION"
End If

...etc

end function


if I use the debugger, MSPapp is nothing... I can not understand the
problem...

Please help me...

Thank you.


JULIEN.
 
I will use your tips for my installation procedure

Thanks for all,

Julien.


Norman Yuan said:
I do not know or bother to find an automatical way to configure local
intranet security for a .NET Windows app. My stratage is:

1. If the Windows app is complicated enough, I would create a setup
project
that produce an installation package, so that the Windows app is installed
on each running computer. Therefore, there is no security problem (of
running code from outside of a computer).

2. I often have a bunch of small .NET Windows apps used in my office. Snce
they are either short lived, or subject to modification fairly often, I
would rather place them on a network share. In this case, I go to each
computer in the office and use .NET Framework configuration panel to to
the
security configurayion once for all: creating a full trusted code group,
and
pointing it a folder on the network share. Now, whenenver I have a new
.NET
Windows app that I want to place it on network share, I just drop it into
that folder. I only give myslef write permission to that folder, everyone
else can only read and execute from that folder. So that no code can be
run
from that folder without my acknowledge. Note, the .NET framework
configuration for code running from local intranet only need to be done
once
(I make it into the check list of our standard computer setup procedure).

Julien NICOLAS said:
Hi Norman,

You are right for the MS .NET security setting, I was find this way and I
prefer to configure security just for my assembly.
The problem is : I need to do this automatically in my installation
procedure.... but I don't know how to do this !
May I do it by launching the MS .NET security assistant in silent mode... if
this mode is existing...

So for instance I have no way to do it automatically.

If you have some clues....

Thank you.

Julien.


Norman Yuan said:
Go to "Control Panel -> Administrative Tools -> Microsoft .NET
Framework
1.1
[1.0] Configuration" to configure security settings. The simplest way
is
to
give "Local Intranet" zone full trust by highlighting "My
Computer->Runtime
Security Policy" node on the left and clicking "Adjust Zone Security" link
on the right side. Warning: this adjustment is a bit risky and not
recommended unless you have very small network and you have controls on
the
security of the network. Better approach is to create a code group and
give
required security settings to that code group. You need to explore more on
this topic once you get your app running.

Hi Norman,

Yes, my dll file is using by a window form application (1 form with 1
button
to test my createproject function)

I think the security setting is the problem because before using the
function On Error Resume Next, I had a security error message from the
mscorlib.dll.

So how can I autorize my application to run from a network drive ? How
can
I
change the security of the mscorlib.dll ?

Please help me...

Julien.


"Norman Yuan" <[email protected]> a écrit dans le message de (e-mail address removed)...
Assume you are talking Windows Form App, and you have done necessary
security setting changes that allows your Windows app can be loaded
from
a
network share (by default, .NET windows app is not allowed to run from
a
network share).

From what I see, at least you did not handle possible exception at

MSPapp = New MSProject.Application

That means, if this line od code cannot create "MSPrioject.Application"
object, the routine will go on (since On Error Resume Next
instruction),
and
you will get Nothing for MSProject. So, the code just did what you
expect
it
doing correctly. As for why MSPapp = New MSProject.Application not
working,
I do not know (bad reference, maybe?).

However, since you mentioned it works from local drive, not from
network
drive, I suspect that the function you though causing problem may
not
be
the
source of problem, it is the security thing + a general "On Error
Resume
Next" on the higher level causes problem and the code in the
function
did
not get run at all. By the way, why on the earth do you use "On
Error
Resume
Next", instead of more powerful "Try...Catch..."?

Hello,

I have a dotnet dll file.
This dll is to use MS Project by VB.

When I am launching my application from a local drive (c:\mylocapp) :
no
problem

The Problem is when I am trying to launch my application from a
network
drive : my "W:" is "\\Server\Testappli"


I am using this code :

public function CreateProject(byval pstr_ProjName as string) as string
On Error Resume Next
Err.Clear()
MSPapp = GetObject(, "MSProject.Application")
If Err.Number <> 0 Then
Err.Clear()
MSPapp = New MSProject.Application
End If
If IsNothing(MSPapp) Then
CreateProject = "FALSE¤CREATION"
End If

...etc

end function


if I use the debugger, MSPapp is nothing... I can not understand
the
problem...

Please help me...

Thank you.


JULIEN.
 
Back
Top