Home All Groups Group Topic Archive Search About

Cannot run program from network drive

Author
4 Apr 2005 4:25 AM
Bendix
Hi All,

The following program module (written in VS.NET 2002) runs fine from local
drive.

Dim sqlCnn As New SqlClient.SqlConnection()
Dim sqlDaDB01 As New SqlClient.SqlDataAdapter()
Dim sqlCmd As New SqlClient.SqlCommand()
Dim intTemp As Integer

sqlCnn.ConnectionString = "data source=SERVERA;initial
catalog=DatabaseA;integrated security=SSPI;persist security info=False"
sqlCnn.Open()
sqlCmd.CommandText = "exec test1"
sqlCmd.CommandType = CommandType.Text
sqlCmd.Connection = sqlCnn
sqlCmd.CommandTimeout = 1800
Console.Write("Update in progress. Please wait......")
intTemp = sqlCmd.ExecuteNonQuery()
sqlCnn.Close()
MsgBox("Job finished", MsgBoxStyle.Information, "...")


However, when I put it into a network drive, an error show up:-

"An unhandled exception of type 'System.Security.SecurityException' occurred
in Unknown Module.
Additional information: Request failed."


Is there anybody know how to fix this problem? Thanks a lot!

Author
4 Apr 2005 8:41 AM
Gabriel Lozano-Morán
It might not be recommended but you can set the permission set of the
localintranet_zone to "full trust" on machine level.

1. On your local development machine open the property window of Start ->
Adminstrative Tools -> Microsoft .NET Framework 1.1 Configuration -> Runtime
Security Policy -> Machine -> Code Groups -> All_code -> localintranet_zone

2. Go to tab "Permission set"

3. Set the permission set to fulltrust

Gabriel Lozano-Morán

Show quoteHide quote
"Bendix" <Ben***@discussions.microsoft.com> wrote in message
news:E0C3AFA0-7DE9-4D8B-BF10-C96E2F4688B1@microsoft.com...
> Hi All,
>
> The following program module (written in VS.NET 2002) runs fine from local
> drive.
>
> Dim sqlCnn As New SqlClient.SqlConnection()
> Dim sqlDaDB01 As New SqlClient.SqlDataAdapter()
> Dim sqlCmd As New SqlClient.SqlCommand()
> Dim intTemp As Integer
>
> sqlCnn.ConnectionString = "data source=SERVERA;initial
> catalog=DatabaseA;integrated security=SSPI;persist security info=False"
> sqlCnn.Open()
> sqlCmd.CommandText = "exec test1"
> sqlCmd.CommandType = CommandType.Text
> sqlCmd.Connection = sqlCnn
> sqlCmd.CommandTimeout = 1800
> Console.Write("Update in progress. Please wait......")
> intTemp = sqlCmd.ExecuteNonQuery()
> sqlCnn.Close()
> MsgBox("Job finished", MsgBoxStyle.Information, "...")
>
>
> However, when I put it into a network drive, an error show up:-
>
> "An unhandled exception of type 'System.Security.SecurityException'
> occurred
> in Unknown Module.
> Additional information: Request failed."
>
>
> Is there anybody know how to fix this problem? Thanks a lot!
>
Author
6 Apr 2005 4:43 PM
Joseph MCAD
April 6, 2005

    You are right. Doing that isn't recommended. What would be better is to
strong name the assembly and then create a code group under
LocalIntranet_Zone that gives FullTrust to assemblies with that strong name.
What are the details of the Security Exception? I believe I could solve your
permission problem, if I had the details?


      Joseph MCAD



Show quoteHide quote
"Gabriel Lozano-Morán" wrote:

> It might not be recommended but you can set the permission set of the
> localintranet_zone to "full trust" on machine level.
>
> 1. On your local development machine open the property window of Start ->
> Adminstrative Tools -> Microsoft .NET Framework 1.1 Configuration -> Runtime
> Security Policy -> Machine -> Code Groups -> All_code -> localintranet_zone
>
> 2. Go to tab "Permission set"
>
> 3. Set the permission set to fulltrust
>
> Gabriel Lozano-Morán
>
> "Bendix" <Ben***@discussions.microsoft.com> wrote in message
> news:E0C3AFA0-7DE9-4D8B-BF10-C96E2F4688B1@microsoft.com...
> > Hi All,
> >
> > The following program module (written in VS.NET 2002) runs fine from local
> > drive.
> >
> > Dim sqlCnn As New SqlClient.SqlConnection()
> > Dim sqlDaDB01 As New SqlClient.SqlDataAdapter()
> > Dim sqlCmd As New SqlClient.SqlCommand()
> > Dim intTemp As Integer
> >
> > sqlCnn.ConnectionString = "data source=SERVERA;initial
> > catalog=DatabaseA;integrated security=SSPI;persist security info=False"
> > sqlCnn.Open()
> > sqlCmd.CommandText = "exec test1"
> > sqlCmd.CommandType = CommandType.Text
> > sqlCmd.Connection = sqlCnn
> > sqlCmd.CommandTimeout = 1800
> > Console.Write("Update in progress. Please wait......")
> > intTemp = sqlCmd.ExecuteNonQuery()
> > sqlCnn.Close()
> > MsgBox("Job finished", MsgBoxStyle.Information, "...")
> >
> >
> > However, when I put it into a network drive, an error show up:-
> >
> > "An unhandled exception of type 'System.Security.SecurityException'
> > occurred
> > in Unknown Module.
> > Additional information: Request failed."
> >
> >
> > Is there anybody know how to fix this problem? Thanks a lot!
> >
>
>
>
Author
11 Apr 2005 6:27 AM
Bendix
I tried the not recommended solution, but it only work for that specific
computer. What if I want to run the program from a lot of workstations?

Bendix

Show quoteHide quote
"Joseph MCAD" wrote:

>
>   April 6, 2005
>
>     You are right. Doing that isn't recommended. What would be better is to
> strong name the assembly and then create a code group under
> LocalIntranet_Zone that gives FullTrust to assemblies with that strong name.
> What are the details of the Security Exception? I believe I could solve your
> permission problem, if I had the details?
>
>                                                                             
>       Joseph MCAD
>
Author
11 Apr 2005 12:20 PM
Joseph MCAD
April 8, 2005

    To make this work for all computers, just add this code group under the
Enterprise --> All_Code group. Do the exact same thing and let the assembly
have FullTrust, but check the box that states Policy levels below this level
will not be evaluated and check This policy level will only have the
permissions from the permission set associated with this code group. This
will allow the assembly to have fulltrust throughout the domain. Hope this
helps!

                                                      Joseph MCAD



Show quoteHide quote
"Bendix" <Ben***@discussions.microsoft.com> wrote in message
news:46772C63-25DF-4353-BC39-CF9E049BDF4A@microsoft.com...
>I tried the not recommended solution, but it only work for that specific
> computer. What if I want to run the program from a lot of workstations?
>
> Bendix
>
> "Joseph MCAD" wrote:
>
>>
>>   April 6, 2005
>>
>>     You are right. Doing that isn't recommended. What would be better is
>> to
>> strong name the assembly and then create a code group under
>> LocalIntranet_Zone that gives FullTrust to assemblies with that strong
>> name.
>> What are the details of the Security Exception? I believe I could solve
>> your
>> permission problem, if I had the details?
>>
>>
>>       Joseph MCAD
>>
>
Author
11 Apr 2005 12:54 PM
Nicole Calinoiu
"Joseph MCAD" <anonym***@microsoft.discussions.com> wrote in message
news:%23JPQQDpPFHA.1884@TK2MSFTNGP15.phx.gbl...
> April 8, 2005
>
>    To make this work for all computers, just add this code group under the
> Enterprise --> All_Code group.

This will include applications run from the internet, so it's not
necessarily a great idea even if a strong name membership condition will
also be used.  One can add a local intranet zone group under All_Code at the
enterprise level configured identically to the group that is included by
default at the machine level.  The new strong name group should be placed
under such a group in order if the goal is to trust assemblies signed with
the relevant key iff they are run from within the intranet.


> Do the exact same thing and let the assembly
> have FullTrust, but check the box that states Policy levels below this
> level
> will not be evaluated and check This policy level will only have the
> permissions from the permission set associated with this code group. This
> will allow the assembly to have fulltrust throughout the domain.

No, it will not.  Despite its name, the enterprise policy resides on the
local client machine, and changes are not automatically propagated over a
domain.  Changes to the enterprise policy must be deployed to the respective
client machines (exactly as if they were changes to the machine-level
configuration).  On a Windows domain, one fairly common means of deploying
such policy changes is as an MSI (created via .NET Configuration MMC)
distributed as a GPO.



Show quoteHide quote
> Hope this
> helps!
>
>                                                      Joseph MCAD
>
>
>
> "Bendix" <Ben***@discussions.microsoft.com> wrote in message
> news:46772C63-25DF-4353-BC39-CF9E049BDF4A@microsoft.com...
>>I tried the not recommended solution, but it only work for that specific
>> computer. What if I want to run the program from a lot of workstations?
>>
>> Bendix
>>
>> "Joseph MCAD" wrote:
>>
>>>
>>>   April 6, 2005
>>>
>>>     You are right. Doing that isn't recommended. What would be better is
>>> to
>>> strong name the assembly and then create a code group under
>>> LocalIntranet_Zone that gives FullTrust to assemblies with that strong
>>> name.
>>> What are the details of the Security Exception? I believe I could solve
>>> your
>>> permission problem, if I had the details?
>>>
>>>
>>>       Joseph MCAD
>>>
>>
>
>