How can I mount a shared fold at startup or automatic; no login?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GNoter
    New Member
    • Feb 2007
    • 9

    How can I mount a shared fold at startup or automatic; no login?

    We've a Windows 2003 server; 2 of them in a webfarm (network load balanced, or NLBs).

    We have a 3rd server which has an Access database to which the NLBs need access to.

    Is there any way to "mount" a shared folder on the 3rd server (\\Server3\MSAc cess\) as a specific lettered drive when the sever starts up (vs having to log on)?

    Also, how would one set it up to ensure the folder remains mounted (a scheduled task..??)?

    Thx,

    Gary Noter
  • GNoter
    New Member
    • Feb 2007
    • 9

    #2
    Here's more info:

    I'm using ASP.NET v1.1, using a standard OLEDb connection (referencing the database by path [see code below]).

    From the ASP.NET v1.1 "web.config " file (I'll refer to this as ConnectStringA)
    Code:
     <appSettings>
        <add key="strConnectAccess" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Server3\MSAccess\DatabaseFile.mdb"/>
    </appSettings>
    actual "connect" code:
    ... I'm pausing here.
    I went to go look at the connection code and there is a direct inline connection string to another database which appears to not be failing:
    \\Server3\C$\MS Access\LogError .mdb
    --> I'll refer to this as ConnectStringB,

    The difference between ConnectStringA and ConnectStringB is that ConnectStringA assumes a shared folder, whereas ConnectStringB goes direct, as it includes the "\C$" element.

    Well, I added the "\C$" to ConnectStringA, (now "\Server3\C$\MS Access\Database File.mdb") and it still fails.


    Yes, I would agree there is some sort of permissions error. The database is set for Shared, not Exclusive.

    Here is my "connect" code (modified to protect a client's database)
    Code:
        Sub btnlogin_click(ByVal sender As Object, ByVal e As EventArgs)
            Dim conpw As OleDb.OleDbConnection
            Dim cmdpw As OleDb.OleDbCommand
            Dim strsql As String
    
            Dim dappw As OleDb.OleDbDataAdapter
            Dim dstpw As DataSet
            Dim rowpw As DataRow
            Dim bldpw As OleDb.OleDbCommandBuilder
            Dim inti As Integer
            Dim rdrpw As OleDb.OleDbDataReader
    
            Dim xx As String
            Dim yy As String
            Dim strmsg As String
            Dim strcounties As String
            Dim lngposition As Long
            Dim strIsCSR As String
    
            If txtIsCSR.Checked = "True" Then
                Session.Contents("IsUser2") = "True"
                Session.Contents("userName2") = txtUserName.Value
                Session.Contents("userPass2") = txtPassword.Value
                Response.Redirect("user2Logon.aspx")
            End If
    
            lngposition = InStr(txtPassword.Value, "'")
            If lngposition > 0 Then
                Response.Redirect("loginError.aspx")
            End If
    
    
            conpw = New OleDb.OleDbConnection(ConfigurationSettings.AppSettings("strConnectAccess"))
            conpw.Open()
    
    
            strsql = "SELECT * " & _
            "FROM [ User] " & _
            " WHERE ( ([ User]].UserName = '" & txtUserName.Value & "') AND ([ User].password = '" & txtPassword.Value & "') )  "
    
            cmdpw = New OleDb.OleDbCommand(strsql, conpw)
            rdrpw = cmdpw.executereader
    
            xx = 0
            While rdrpw.read
                xx = xx + 1
                strmsg = rdrpw.item("userID") + rdrpw.item("userName")
                strcounties = strcounties + strmsg
            End While
    
            conpw.close()
    
            If xx > 0 Then
                Session.Contents("counties") = txtMemberid.Value
                Response.Redirect("Here.aspx")
            Else
                If Len(Trim(Session.Contents("logintrys"))) = 0 Then
                    Session.Contents("logintrys") = 0
                End If
                ctry = (Session.Contents("logintrys"))
                ltrys = CInt(ctry) + 1
                If ltrys > 6 Then
                    Response.Redirect("lockout.aspx")
                End If
                ctry = CStr(ltrys)
                Session.Contents("logintrys") = ctry
                Response.Redirect("loginError.aspx")
            End If
    
        End Sub
    So, in all, this error [below] is occuring, it does point to "permission s" of some kind. Thing is, how to I "connect" from a webfarm not on a domain to a server (Server3) which is on a domain?
    The Microsoft Jet database engine cannot open the file '\\Server3\C$\M SAccessDBs\Data base.mdb'. It is already opened exclusively by another user, or you need permission to view its data.

    Comment

    • Cyberdyne
      Recognized Expert Contributor
      • Sep 2006
      • 627

      #3
      Try sharing the folder instead and giving that particular username rights to read and write the msdatabase folder and then in the code use

      \\Server3\Share name\Database.m db

      See if that works, good luck.

      Cyber

      Comment

      Working...