I am using a member login program that restricts access according to security levels, and have subdomains on my website. My challenge is that I want the program to access the same database (on the domain) from both subdomains. The file I've been told to change is this:
- <%
-
' FileName="Connection_ado_conn_string.htm"
-
' Type="ADO"
-
' DesigntimeType="ADO"
-
' HTTP="true"
-
' Catalog=""
-
' Schema=""
-
MM_membersareamanager_STRING = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/databases/MembersAreaManager.mdb") & ";"
-
%>
I've been instructed to change it to call on the main domain, but am at a loss as to how to do this. Any advice would be greatly appreciated.
The line you need to change is line 8. The Server.mapPath() function takes a file and returns the absolute path (beginning with drive letter) of the db you want to use. If the db is not in the same sub-domain as the script, I believe you will need to specify the absolute path like this:
- MM_membersareamanager_STRING = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:/inetpub/databases/MembersAreaManager.mdb;"
I've never tried to connect this way, mostly because I don't want to worry about permissions across that many directories. Another approach would be to set up a data source name (control panel --> administrative tools --> data sources --> system DSN) then your connection string would look like this:
- MM_membersareamanager_STRING = "Provider=Microsoft.Jet.OLEDB.4.0; DSN=membersAreaManager;UID=myUserID;PWD=myPWD;"
I find this approach a little more useful in the long run (it allows you to change the file location or even to which db the dsn refers without changing your scripts at all). Let me know if this helps.
Jared