473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Can my asp application access a database on the main domain from a subdomain?

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:
Expand|Select|Wrap|Line Numbers
  1.       <%
  2.       ' FileName="Connection_ado_conn_string.htm"
  3.       ' Type="ADO"
  4.       ' DesigntimeType="ADO"
  5.       ' HTTP="true"
  6.       ' Catalog=""
  7.       ' Schema=""
  8.       MM_membersareamanager_STRING = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/databases/MembersAreaManager.mdb") & ";"
  9.       %>
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.
Jan 14 '08 #1
1 1459
jhardman
3,406 Expert 2GB
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:
Expand|Select|Wrap|Line Numbers
  1.       <%
  2.       ' FileName="Connection_ado_conn_string.htm"
  3.       ' Type="ADO"
  4.       ' DesigntimeType="ADO"
  5.       ' HTTP="true"
  6.       ' Catalog=""
  7.       ' Schema=""
  8.       MM_membersareamanager_STRING = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/databases/MembersAreaManager.mdb") & ";"
  9.       %>
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:
Expand|Select|Wrap|Line Numbers
  1.  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:
Expand|Select|Wrap|Line Numbers
  1.  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
Jan 16 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: spike | last post by:
I tried to upload a .htaccess-file to the directory that i wanted to protect. This is what I wrote in it: ------------------------------------------------ <Limit GET> order deny,allow deny from...
0
by: Leon | last post by:
How do I point a sub-domain to a sub-directory or .aspx page of my site using asp.net? I'm using a shared hosting service, that does not offer subdoman forwarding. however, you can write your...
3
by: ramonred | last post by:
Hi, I have two web apps. Lets say main and admin for the sake of simplicity. admin is a web app within main (as a subdomain). So the path for admin is http://admin.main.com within the admin...
4
by: Bill Borg | last post by:
Hello, I have a large commerce app, hosted for several hundred companies (i.e. each "company" is a small business selling something through my site, independent of all the others). Each...
13
by: gsecrets | last post by:
Hi friends.. I have a table with the following ..... fields URL Domain The domain name has the following suffix ..edu, .com, .org, .ca.org etc;
3
by: buynorwex | last post by:
I am using a member area manager program, 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...
1
by: abhijitbkulkarni | last post by:
Hello, I am designing a .NET database application that uses 3 tier architecture. Starting initially, this application will be desktop application but I will convert it into a website later but...
6
by: totalstranger | last post by:
Using an AJAX Javascript function that works fine if it's in the primary domain www.arnb.org, but suffers from a security error when attempted from a subdomain, thepatsyreport.arnb.org In the...
3
by: bnashenas1984 | last post by:
Hi everyone I'v made a website which allows users to have their own subdomains Each user can have a blog in a unique subdomain Now I need to let my users register their own domain names and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.