Question

Access Web Database Issue

Asked by: AEII

I have a failrly simple Login Program I purchased several years ago, and I have to move the website to another server ... It has a two level login access ... users for a members only area, and then a superadmin so I can look at statistics, etc ...

The first level works fine after the transfer ... the second doesn't.
The first level login connection string to the Access database is:
"database/Login.mdb"

The original connection screen for the second level was:
"../database/Login.mdb" (And it still works on the old server)

But now gets this error message on the new server:

Server.MapPath() error 'ASP 0175 : 80004005'
Disallowed Path Characters
/Login/admin/Connections/connAdmin.asp, line 9
The '..' characters are not allowed in the Path parameter for the MapPath method.

I am not sure why ... but the new server is Windows 2003 and the old one was Windows 2000.

I have tried to use the same connection string for the second level as the first and it does
not work either ... it gets the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

/Login/admin/default.asp, line 15




This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-04-10 at 18:10:45ID23313871
Topics

Active Server Pages (ASP)

,

.Net Editors & IDEs

,

Microsoft Access Database

Participating Experts
2
Points
500
Comments
9

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Server MapPath with direct address
    Having a problem connecting to an access database on a second server with that server's direct address. Set objDC = Server.CreateObject("ADODB.Connection") objDC.Open "DBQ=" & Server.MapPath("\\Server2\ServerDBs\TestDB.mdb") & _ &qu...
  2. Server MapPath with direct address (2)
    Having a problem connecting to an access database on a second server with that server's direct address. Same problem, different error message, I used the answer given in Server MapPath with direct address (the original). objDC.Open "DBQ=\\Server2\ServerDBs\TestDB.mdb;&q...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: cedlinxPosted on 2008-04-10 at 23:40:30ID: 21331766

Please let's see the code on the following lines.

default.asp, line 15
connAdmin.asp, line 9

And the full path to you database and website

Meanwhile, for the error in connAdmin.asp, line 9, try to use the FULL pathname instead of ...

 

by: AEIIPosted on 2008-04-11 at 06:23:41ID: 21333964

default.asp Line 15:
MM_rsUser.ActiveConnection = MM_Conn_STRING

connAdmin.asp Line 9:
MM_Conn_STRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database/Login.mdb") & ";"
'MM_Conn_STRING = "dsn=classified411;"

I am not sure how to use a "full path" for this string.
I have tried the "http://www.mydomain.com/Login/Database/Login.mdb"
and the the error states I am using invalid characters.

The string I included above for the connAdmin.asp is the same string as the level 1 login ...

My guess is the string to the database needs to account for the level 1 login is in the same folder level as the default.asp for level 1 login and the level 2 is one folder level deeper.

The entire program is in the Login folder ... it has the default.asp for level 1 login in it and a connections folder as well as a database folder containing the Login.mdb.

Then also in the Login Folder is an admin folder where there is a default.asp for the second default.asp and a connections folder which is the above connAdmin.asp.

 

by: JagCPosted on 2008-04-11 at 07:17:31ID: 21334478

A "path" is the folders that need to be traversed to reach the file in the file system.
The one you trued ("http://www.mydomain.com/Login/Database/Login.mdb") is a URL, not a path.
A path would include the drive and the folders.

The easiest way is to find the path to teh database on the server. Using Windows simply open a window, navigate to the folder with the file and (if you have show address bar) you can simply copy the path.

eg
If all your sites on the server are in the D drive under a folder called "websites" then the path to your DB may be something like:
d:\websites\loginsite\Login.mdb

Extra Info (don't read if you don't want to :)
Using MapPath has the advantage of you not needing to know where the DB is. BUT (and it's a big but) this is a security issue as the DB MUST be in a web accessable folder (ie a folder or subfolder below the main site folder.

To clarify:
The website called MySite is in a folder called MySite. It is in a folder called Websites that is on the D drive.
In IIS (or whatever webserver) you specify the folder that contains the site - this folder and all subfolders and files are accessable from the web (or intranet). (This assumed the user specified in IIS has access to the folders which is usually will).

What I tend to do is create 2 folders, public and private, within the web site folder and point the web server at the public folder.

So we have: d:\websites\MySite\public where all the HTML files, images etc go. And this is set on the web server.
d:\websites\MySite\private is where the database goes plus any other files that the site will access BUT I don't want to be downloaded, viewed etc.

But, because the "private" folder isn't within the "public" folder you cannot use Server.MapPath. but it means the DB cannot be accessed by entering the URL to it.

Sorry for the digression, hopefully I made sense :)

 

by: cedlinxPosted on 2008-04-11 at 07:37:20ID: 21334648

>>Then also in the Login Folder is an admin folder where there is a default.asp for the second default.asp and a connections folder which is the above connAdmin.asp.

Does that mean that connAdmin.asp is in a folder called connections? or just in the folder called admin?

 

by: AEIIPosted on 2008-04-11 at 08:27:58ID: 21335171

JagC
I am going to have to digest your information a little but I think I understand, but
in this case we have moved the site to our own server so I would know the actual local path E:\Websites\MyDomain\Login\Database ... should it be "\" or "/" ?

And why then does the level 1 work fine directed to the same folder ? Why
does the "../database/Login.mdb" work on the other server ?

cedlinx:
Yes there is a connections folder in the admin folder too ... would it have worked better to include the conn.asp on the admin default.asp page instead of the
other ? Or why did the developer use two connection files instead of one centeralized since it uses the same database ?

or maybe I should just add another database folder inside the admin folder ?
I am only storing my SuperAdmin that can access the Level 2 ?

 

by: JagCPosted on 2008-04-11 at 08:55:28ID: 21335428

I remember having issues with .. and Server.MapPath many years ago. But I now have a library of functions I use and MapPath isn't in any of them so I can't remember what the issue was :(

".." means go up a level in teh folder tree (technially, it should be go down, toward the root but hey...).
I am assuming that if you were already at the top level and tried to go 'up' this would fail as MapPath can only access files/folders that are web accessable ie in the site root.

Re-reading your oringal post I assume your folder structure is something like:

E:\Websites\MyDomain\Login\login.mdb
E:\Websites\MyDomain\Login\ other files for level 1 access
E:\Websites\MyDomain\Login\admin\ files for level 2 (admin) access

the reason the admin connstring is adding ".." to the beginning is because it is telling ASP that it is in "one folder up" (ie the folder above \admin).

To avoid this, BOTH connection strings should both therefore use:
E:\Websites\MyDomain\Login\login.mdb

As this is an absolute path (as opposed to a relative one) the site should never get confused as to where to look as you are explicitly specifying where the DB file is.

As to your question "Or why did the developer use two connection files instead of one centeralized since it uses the same database ?"
The answer could be any of the following:
they were on drugs
they can't code
they know something we don't
the aliens told them to do it

Two connection strings are partially understandable if using something like MS SQL server where the actual 'user' that gets used to access data may be different depending on who you're logged onto the site as. ie a normal user connects with a very restricted user while an admin may connect with a less restrictive one. But this can usually be done with code.
So no idea why in this case...

As to your other question as to why does it work on the old server.
'Tis a mistake to assume that things will work when you move them. They rarely do.
Handy tip: to avoid probs moving sites include a config file on every page that set site globals such as conn strings, paths etc. Also don't use server specific stuff like DSNs. Moving a site from one server to another 'can' be painless 'if' the site is designed/coded to allow for this.

 

by: AEIIPosted on 2008-04-11 at 09:06:34ID: 21335528

During my tests ... I just set up another copy of the database folder and mdb in the Admin folder to test the connection string ... it worked fine !

However, one of the features I use then I login to Level 2 is review login history of users ... when I use this db of course it does not have the current table for them since it is in the other folder ...

So I tried some connection paths ...
   1) "/database/Login.mdb"               Only looks in current folder level
   2) "../database/Login.mdb"             Nope does not work on this server
   3) "//database/Login.mdb"              Nope systax issue
   4) "Login/database/Login.mdb"       Nope can not path
   5) "/Login/database/Login.mdb"      WORKS !!!!!!

 

by: AEIIPosted on 2008-04-11 at 09:09:31ID: 31447960

Thanks

 

by: JagCPosted on 2008-04-11 at 09:26:19ID: 21335702

I forgot to answer a question you asked earlier. It was to do with \ and /

\ is used in paths. It signifies a folder
/ is used in URLs and it also signifies a folder
\ was made up by Microsoft in DOS. I believe Unix etc always use / and MS wanted to be "different"

As a result I think most browsers will accept / or \ as they both mean the same thing.
Windows (and DOS) on the other hand use \ when using paths and UNCs and / when using URLs

Just a note concerning paths AND URLs.
If you start the path/URL with a folder or file name then it will assume that the file/folder/path is in the current folder.
If you start it with / or \ it will start in the root (eg c: or the site root).
It's also a good idea to get into the habit of using / for URLs (www.mysite.com/stuff/something.htm) and \ for paths (c:\stuff\file.txt) and UNCs (\\mypc\shared\arg.jpg).
Not that I think it really matters much apart from when \ is at the begining.

At least you got it sorted though :) Nice one.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...