473,569 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

3 New Member
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 1463
jhardman
3,406 Recognized Expert Specialist
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
1206
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 all allow from mydomain.com </Limit>
0
1523
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 own asp.net redirect code, and I just want to the best way to accomplish this task. it's possible that I may could have a 1000 subdomain names to...
3
5408
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 application I have a file upload page and I wish to upload the files to the main application. I have tried this application of MapPath and it fails. ...
4
1562
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 company has a unique ID (e.g. 12345), which is a primary key in the tables for products, customers, etc. That key also identifies company-specific...
13
5158
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
1251
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 been told to change is this: <% ' FileName="Connection_ado_conn_string.htm" ' Type="ADO" ' DesigntimeType="ADO" ' HTTP="true" ' Catalog="" '...
1
2331
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 design that I am planning should support both version. Development Environment : VS2008, C# Currently Database supported are MS SQL Server 2005 and...
6
2040
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 subdomain HTML I have a base statement, and set document.domain to 'arnb.org' with Javascript <base href="http://www.arnb.org" /> Anyone know how...
3
1838
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 point it to their subdomain on my website. For example : when a user registers a domain name on any website (www.usersname.com) and connects it to his...
0
7695
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.