• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

can't access database using Server.MapPath in apache

Hi!

I'd like to ask if there's a way I can access the database using Server.MapPath in apache?
Here's my sample code:
strTemp = new String(Server.MapPath('pal.mdb'))
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strTemp + ";Persist Security Info=False"
var objConn = Server.CreateObject("ADODB.Connection")
objConn.Open(strConnect)

Hope you can help me out! :)

Thanks!
0
coolnsimple
Asked:
coolnsimple
  • 8
  • 3
  • 2
1 Solution
 
rdivilbissCommented:
Server.MapPath is a ASP object.method.  ASP is specific to Windows IIS servers.

Apache web server does not have ASP objects.
0
 
tomvergoteCommented:
unless he is using chilisoft or something
Coolnsimple could you provide more information about your environment?

One thing i think of right away:
new String(Server.MapPath('pal.mdb')) should be new String(Server.MapPath("pal.mdb")) with double quotes.
Maybe your apache config is a bit more strict in executing buggy scripts

BTW:
strTemp = new String(Server.MapPath('pal.mdb'))
>> This shows your database is inside your website, that is very bad practice since it allows anyone to download it.
If somebody does a request to http://www.yourserver.org/pal.mdb they'll just download the file (I hope there aren't any sensitive data in it)
Yeah I know they'll have to know the filename, but a random asp error could display the database location to your visitors.

I would suggest you move your database somewhere outside your website root
0
 
rdivilbissCommented:
ChiliASP was bought by SUN.  I don't think they offer an Apache version any more....but it could be an old version.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
rdivilbissCommented:
tomvergote,

Maybe he is using this:

http://www.apache-asp.org/config.html

0
 
tomvergoteCommented:
could be, I didn't know about it, thanks for the link.
As long as he doesn't post back I'm assuming his config borks on the single quote thing
0
 
rdivilbissCommented:
I didn't know about it either.  Wasn't even looking for it.  Just stubled across it.

Might be pretty interesting, although I doubt I'll run downstairs and build an Apache box today.
0
 
coolnsimpleAuthor Commented:
Hi!  Tried the double quote thing but didn't work...
Im under windows NT and I'm using apache2.0...
I tried to check on the config file httpd, but didn't know what parameters or settings to modify, also didn't know if new settings would help to access database.

Tomvergote, thanks for the advice, but this would be used in the intranet only and there wouldn't be any important data in it. :)
0
 
rdivilbissCommented:
Your map path may be included in you connection string.  You should not need the persist security for access.  This is a working connection string.

connection = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/database/examples.mdb"))
0
 
tomvergoteCommented:
but we still don't know how he is running asp :)
Neither if he get's an indicative error message
0
 
rdivilbissCommented:
True, but I'm assuming the Apache-ASP link I found.
0
 
rdivilbissCommented:
coolnsimple.

Did these suggestions help you solve your problem or do you still need assistance?

Regards,
Rod
0
 
coolnsimpleAuthor Commented:
I still do need some assistance, I tried to search also for solution but didn't find any.  Hopefully you guys would be able to suggest a better web server...
Unfortunately, I don't have an installer for window nt server so I don't have IIS, as for apache, it also seems that it cannot read include files, when I tried to cut 1 asp page to several parts and have them included in the codes like "<!--#include file="incTop.asp"-->", apache can't seem to recognize and does not display the include files.
So I'm looking for a freeware and better web server which can be compatible with asp objects...better if you'd be able to provide me a link with the installer. :)

Thanks!
0
 
rdivilbissCommented:
Did you look at http://www.apache-asp.org

the syntax is a bit different from IIS

e.g. <!--#include file=filename.inc-->

instead of <!--#include file="filename.inc"-->

AND

$Server->MapPath($url);

instead of

Server.MapPath("url")

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 8
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now