473,748 Members | 6,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

placing DB outside the web root ...where? and path in ASP?

i learnt from *Ken Schaefer's* website that for security reasons, u
should put your DB outside the website root directory. this is his
webpage -
http://www.adopenstatic.com/resource.../structure.asp

1. where do i place the database outside the root directory? my
directory access from my hosting company (windows 2000 server) is like
this:

ftp.mywebsite.c om
- mywebsite.com (folder)
parent folder
documents (this is the root directory folder)
log files (folder)


2. what should be the new path in asp pages to make a DB connection,
e.g.
DSNtemp=dsntemp & "DBQ=" & server.mappath( "database.m db")
Jul 19 '05 #1
4 4812
> 1. where do i place the database outside the root directory?

You don't always have the luxury of doing this. I think in most cases, this
applies to people who have control over their servers. So, you might have
to ask your hosting company to set up a virtual FTP folder that points
off-web, so that you can upload the database there. But then it's still
exposed via FTP. And you would have to hard-code the reference to the MDB
file in your connection string, e.g. F:\protected\fi le.mdb (you can no
longer use server.mappath) . This isn't so much of a problem, except folder
structures, and even the drive letter itself, aren't guaranteed to remain
intact if the ISP upgrades servers, moves to a new data center, etc.

One way to prevent people from downloading your MDB file, even if they
*could* guess the location and filename, is to give it an ASP extension. It
will still work as a database file (your connection string would point to an
..asp file instead of an .mdb file), and users wouldn't be able to download
it by accessing it directly, because the web server will try to run it like
an ASP script.

And yes, it will still be exposed via FTP, but if you name it something
inconspicuous, a user who managed to break in would have to figure out (a)
that your database is actually in an ASP file, and (b) which one it is.
There shouldn't be any way a casual sniffer would even know you're using
Access in the first place, unless you advertise that.
Jul 19 '05 #2
I've tested using an asp extension to the databasefile (database.asp and
not database.mdb). But if you connected to database.asp (typing in the
correct path and filename), it appeared in the browser as a textfile,
with parts of the content clearly possible to read.
The site is on a webhotel (running MS Server 2003), don't know if
they've missed something.
So we use the very odd foldername + equaly odd databasename

Mats

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
i confirmed with my web hosting company. i can place my database
outside my webroot directory (on a windows 2000 server.)

1. where do i place it 2. what should be the path in asp to make a DB
connection?
e.g. DSNtemp=dsntemp & "DBQ=" & server.mappath( "database.mdb") ?

here is the structure of webfolders that are available to me:

ftp.mywebsite.. ..com
- mywebsite....co m (folder)
parent folder
documents (this is the root directory folder)
log files (folder)

Jul 19 '05 #4
> i confirmed with my web hosting company. i can place my database
outside my webroot directory (on a windows 2000 server.)

1. where do i place it
They need to tell you that; we can't tell you where to put it, because we
don't know what "outside my webroot directory" means.
2. what should be the path in asp to make a DB connection?


That depends on the answer to 1. It will NOT involve server.mappath,
however, as I mentioned in my post yesterday.
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2786
by: cooldv | last post by:
After talking (emailing) to my webhoster, i have placed my access DB in a folder outside the root directory folder; and they gave me a *path.asp* file to put in my root directory folder. ** This webhoster is a real specimen! He/she refuses to provide further support saying it is a script debugging issue*** I need help from ya'll gurus!!!!!! 1a. The path.asp file has only 1 line code: <% = Server.MapPath(".") %>
12
828
by: Jon Maz | last post by:
Hi All, I would like to have the following folder structure for an asp.net website: MasterFolder |---\AppRoot | --- webform.aspx | --- web.config | --- global.asax
4
7859
by: Win, Pats | last post by:
I have a snippet of HTML that I inject into a number of pages throughout my Web site at runtime. My problem is that I'm not getting the image to appear in all documents into which this snippet is injected. If I specify a document-relative path (e.g., src="../someFolder/AnotherFolder/TheGraphic.gif"), then it works fine, but only for documents that exist at the level in the directory structure. I thought I could use a root-relative...
2
2304
by: Jordan Richard | last post by:
Put another way, is there any way I can tell ASP.NET to convert a path (imbedded in a string variable, "~/images/some_image.gif") to a root-relative path, that the client will understand, for the *current* page request? Here's what I'm doing: I am injecting HTML directly into ASPX pages via LiteralControl. something like this...
19
10235
by: Steve Franks | last post by:
I am using VS.NET 2005 beta 2. When I run my project locally using the default ASP.NET Development Web Server it runs using a root address like this: http://localhost:11243/testsite/ However when I deploy to a remote test server running real IIS, the real root of my application becomes: http://localhost/ What I want to do is have it so that on my local machine the asp.net dev
3
1704
by: Nalaka | last post by:
Hi, I have an asp.net web application (www.myWebSite), and a subweb application (www.myWebSite/subSite). How do I set it so that, subweb application (www.myWebSite/subSite) be the root application..... so that, when a user types www.myWebSite/subSite, it actualy, shows pages off subweb.
2
2523
by: gurnandank | last post by:
Hi, I have a web application which uses SSL on one the folders. When I developed application the set up was webroot and under that folder called 'secure'. My ISP has provided a folder called 'secure' on the server which has shared SSL and is sitting outside of the web root, hence the set up called 'secure' and then at the same level a folder called web root. Now, I have two issues:
3
2261
by: Chris | last post by:
When I go into debug mode and the web page I am working on opens in the browser via the local Cassini Web Server I get a path appended onto the full path e.g. localhost:7859/FolderName/filename_that_should_be_in_the_root.aspx this is a pain as I do my links from the root e.g. /css/site.css and the additional folder in the path stops that. Is there any way to get the site in debug mode to show
0
2138
by: deco12 | last post by:
Hi, I am new to web design and Apache, but have managed to password protect my site by putting a .htaccess file in the sites root directory. I have set it up so that a number of members have access to the site. Now, within the site I have a link to a "document" folder which I only want 2 or 3 members to have access to. I have created a second .htaccess & .ht passwd file, with the path to the new folder and a different password. This was...
0
8987
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9534
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9316
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6073
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4597
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
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
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.