Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. error while running from a network machine

error while running from a network machine

Scheduled Pinned Locked Moved Visual Basic
questiondatabasesysadminsecurityhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paps2
    wrote on last edited by
    #1

    Hi all, I have installed my program on my network machine (EXE and the DB) I have set the sharing & Security for the folder of the network machine When I try to run the program from my machine I get the following error: Request for the permission of type System.Data.SqlClient.SqlClientPermission, System.Data, Version= 1.0.5000.0, Culture =neutral, PublicKey Token = b77a5c561934e089 failed It runs fine from the network machine i.e. If run it from the NETWORK machine. This is the code for me to open my conection: Imports System.Data.SqlClient .... Dim Conn As SqlConnection = New SqlConnection Conn.ConnectionString = "Data Source=(local);" & _ "Initial Catalog=Rsch1;" & _ "Integrated Security=SSPI" Conn.Open() How do I set the permision for the network machine? Tnx

    D 1 Reply Last reply
    0
    • P Paps2

      Hi all, I have installed my program on my network machine (EXE and the DB) I have set the sharing & Security for the folder of the network machine When I try to run the program from my machine I get the following error: Request for the permission of type System.Data.SqlClient.SqlClientPermission, System.Data, Version= 1.0.5000.0, Culture =neutral, PublicKey Token = b77a5c561934e089 failed It runs fine from the network machine i.e. If run it from the NETWORK machine. This is the code for me to open my conection: Imports System.Data.SqlClient .... Dim Conn As SqlConnection = New SqlConnection Conn.ConnectionString = "Data Source=(local);" & _ "Initial Catalog=Rsch1;" & _ "Integrated Security=SSPI" Conn.Open() How do I set the permision for the network machine? Tnx

      D Offline
      D Offline
      Dave Bacher
      wrote on last edited by
      #2

      Programs run from a network share run with a lower permission than applications run from the local machine. This is because the network share could be a WebDav drive out on the internet, etc. The first thing is, the connection string won't work from your machine. When your machine runs the code, it will see "Data Source=(local)," and it will attempt to attach to your machine and not the networked machine. Presumably, you want to run against the databse on the network machine. So your connection string needs to look like: Data Source=SERVER\.;Initial Catalog=Rsch1;Integrated Security=SSPI Additionally both your machine and the server must be members of mutually trusted domains, or SSPI will fail. If you are in a workgroup, you probably can't use integrated security (SSPI) reliably, but your milage may vary. Of course, in my version of the connect string, SERVER needs to be either the IP Address of your SQL Server or its machine name -- it shouldn't be the word SERVER unless that happens to be what its name is. Also, you need to make sure that SQL Server is configured to allow remote connections (Surface Area Manager in newer versions configures it for connections from the same machine only by default -- you can change this in your management tool). Additionally, when you are running from a network share, you lose permissions from the .NET framework. When you run from your local drive, you run at full trust. When you run from a network share, you don't run at full trust. This is a defense mechanism against Worm programs and other attacks. In control panel, you can use the .NET Configuration Assistance to trust the assembly or publisher. If you are on a corporate network, you want to have a domain administrator update the group policy to allow the executable the necessary permissions. If you are using .NET 2.0, the SDK provides a program that can tell you the exact permissions your application requires. The tool is named SecUtil, and it usually is in C:\Program Files\Microsoft.NET\SDK\v2.0\bin\secutil -- depending on your install order versus mine, it may be in a different location (I install the SDK, then install Visual Studio -- if you install the SDK as part of Visual Studio, then it ends up under Visual Studio somewhere). There is documentation on the tool on Microsoft's site. Note that you'll have to adjust the machine configuration or user configuration to trust the assembly -- there is nothing you can do on the network share to trust it. This is a defense mechanism. The best

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups