Re: Drive mappings and access to domain directories under IIS

From: Barry Jacobs (a_at_a.com)
Date: 08/02/04

  • Next message: newsreader: "POP3/SMTP NTLM authentication"
    Date: Mon, 2 Aug 2004 14:59:37 +0100
    
    

    Finally found a solution for this, there is an sdk call that simulates net
    use ...

     Private Declare Function WNetAddConnection2 Lib "mpr.dll" Alias
    "WNetAddConnection2A" _
     (lpNetResource As NetResource, ByVal lpPassword As String, ByVal lpUsername
    As String, _
     ByVal dwFlags As Long) As Long

     Private Declare Function WNetCancelConnection2 Lib "mpr.dll" _
     Alias "WNetCancelConnection2A" (ByVal lpName As String, ByVal dwFlags As
    Long, _
     ByVal fForce As Long) As Long

     Private Const NO_ERROR = 0
     Private Const CONNECT_UPDATE_PROFILE = &H1
     Private Const RESOURCETYPE_DISK = &H1

     Private Type NetResource
         dwScope As Long
         dwType As Long
         dwDisplayType As Long
         dwUsage As Long
         lpLocalName As String
         lpRemoteName As String
         lpComment As String
         lpProvider As String
     End Type

    ....

          Dim NetworkMap As NetResource
          Dim Result as Long

          NetworkMap.dwType = RESOURCETYPE_DISK
          NetworkMap.lpRemoteName = "\\<server>\<share>"
          NetworkMap.lpLocalName = Chr(0)

          Result = WNetAddConnection2(NetworkMap, "<password>",
    "<domain>\<user>", CONNECT_UPDATE_PROFILE)
          If (Result = NO_ERROR) Then

              ... Access file via UNC \\<server>\<share>\<filepath>

           Result = WNetCancelConnection2(NetworkMap.lpRemoteName, 0, 0)

          end if

    ....

    "newsreader" <mfleyda@No_Spam.e-one.com> wrote in message
    news:exqNMEJeEHA.1000@TK2MSFTNGP12.phx.gbl...
    > I had the a similar problem accessing shares on our local domain... I
    > found that IIS can only talk with local drives on the box, so unless you
    map
    > the drive on that computer, you are SOL.
    >
    >
    > newsreader
    >
    >
    > "Barry Jacobs" <a@a.com> wrote in message
    > news:#RndxYHeEHA.3124@TK2MSFTNGP09.phx.gbl...
    > > I have a problem with accessing file resources, running VB6 code under
    IIS
    > > 5.0. We have two Domains A and B and a UNC file share on Domain B
    > > (\\B\Directory) having access set to everyone.
    > >
    > > Our IIS session runs under an account on Domain A and some files are
    > present
    > > on domain B. Domain A cannot have any trust relationship with Domain B
    (no
    > > idea if that makes a difference!). Through explorer I can connect to the
    > > files on Domain B with a Domain B account but neither the UNC
    > \\B\Directory
    > > or any mapped drives are available to my code running under IIS.
    > >
    > > So far tried the following:
    > >
    > > 1) Using LogonUser with the domain B account details.
    > >
    > > 2) Running a shell with a net use to \\B\Directory before file access.
    > >
    > > 3) Running a shell with a net use to \\B\Directory spawned with a
    > > CreateProcessWithLogon, after impersonating a domain A account set up on
    > the
    > > host IIS machine.
    > >
    > > None of these work and to be honest I'm really fishing in the dark. Does
    > > anyone have any ideas?
    > >
    > >
    > > Thanks in advance.
    > >
    > > Barry Jacobs
    > >
    > >
    >
    >


  • Next message: newsreader: "POP3/SMTP NTLM authentication"

    Relevant Pages

    • Re: common dialog w/api instead of COMDLG32.OCX, possible?
      ... As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As ... Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias ... Public Property Get FileNameAs String ...
      (microsoft.public.vb.winapi)
    • Re: Incompatibility between Access 2003 and Access 2002
      ... Private WithEvents mlst As ListBox ... Private mot As ObjectType ... Public DisplayField As String ... Dim prm As DAO.Parameter ...
      (microsoft.public.access.modulesdaovba)
    • Re: GetOpenFilename With MultiSelect Intermittently Returns String
      ... ByVal lpWindowName As String) As Long ... Private Declare Function lstrlen Lib "kernel32" _ ... Private Const OFN_ALLOWMULTISELECT As Long = &H200 ...
      (microsoft.public.excel.programming)
    • Re: Getting Windows Display Name
      ... Private Type WKSTA_USER_INFO_1 ... usri3_script_path As Long 'Pointer to a Unicode string specifying the path for the user's logon script file. ... Dim bufptr As Long ... Public Property Get PasswordAgeAs Long ...
      (microsoft.public.access.modulesdaovba)
    • Re: FTP-Service throgh WinInet-API
      ... Dim sTmpPath As String: sTmpPath = AppPath) ... Private hInternet As Long ... Public Declare Function InternetCloseHandle _ ...
      (microsoft.public.vb.general.discussion)

    Loading