473,385 Members | 1,312 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,385 software developers and data experts.

Server.MapPath

I am trying to set up the "path" for were my Access Database is on my
Webhost provideer. When I set up my FTP account, it indicated that my
physical path was "E:\www.MyWebsite.com".

When I asked my webhost if I could use this as my physical address, they
indicated that I should create a directory under the root and place my
access database there and the use the "Server.MetPath(string)" to retrieve
the path.

My question is what value do I place in the "String" portion of the method.
I am guessing that I would put "www.MyWebsite.com/MyDataFolder". Is that
correct?

If that is correct, then how will I be able to modify my code to work on my
test machine and work on the production box without changes? I would guess
that I would use "localhost" or my IP address, but that would not be the
same for when I move the code to the production box. I guess I could place
the value in the web.config file, but is there a better way to do this?

Thanks in advance for your assistance!!!!!!!!!!!!
Nov 18 '05 #1
2 1436
Hi Jim,
You will need to use Server.MapPath not Server.MetPath
In your website say http://www.MyWebsite.com/MyDataFolder
,MyDataFolder is the virtual path.
To translate this virtual path into the actual physical path you need to use
Server.MapPath.
It will be like : Server.MapPath("MyDataFolder") which will give you
the physical path.
The output of this will be like E:\www.MyWebsite.com\MyDataFolder which is
the actual physical path.

Hope this helps.
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com

"Jim Heavey" <Ji*******@nospam.com> wrote in message
news:Xn*********************************@207.46.24 8.16...
I am trying to set up the "path" for were my Access Database is on my
Webhost provideer. When I set up my FTP account, it indicated that my
physical path was "E:\www.MyWebsite.com".

When I asked my webhost if I could use this as my physical address, they
indicated that I should create a directory under the root and place my
access database there and the use the "Server.MetPath(string)" to retrieve
the path.

My question is what value do I place in the "String" portion of the method. I am guessing that I would put "www.MyWebsite.com/MyDataFolder". Is that
correct?

If that is correct, then how will I be able to modify my code to work on my test machine and work on the production box without changes? I would guess that I would use "localhost" or my IP address, but that would not be the
same for when I move the code to the production box. I guess I could place the value in the web.config file, but is there a better way to do this?

Thanks in advance for your assistance!!!!!!!!!!!!

Nov 18 '05 #2
You probably just want Server.MapPath("/MyDataFolder"). Since the string
doesn't contain the host name, there is no need to change it for your test
server.
"Jim Heavey" <Ji*******@nospam.com> wrote in message
news:Xn*********************************@207.46.24 8.16...
I am trying to set up the "path" for were my Access Database is on my
Webhost provideer. When I set up my FTP account, it indicated that my
physical path was "E:\www.MyWebsite.com".

When I asked my webhost if I could use this as my physical address, they
indicated that I should create a directory under the root and place my
access database there and the use the "Server.MetPath(string)" to retrieve
the path.

My question is what value do I place in the "String" portion of the method. I am guessing that I would put "www.MyWebsite.com/MyDataFolder". Is that
correct?

If that is correct, then how will I be able to modify my code to work on my test machine and work on the production box without changes? I would guess that I would use "localhost" or my IP address, but that would not be the
same for when I move the code to the production box. I guess I could place the value in the web.config file, but is there a better way to do this?

Thanks in advance for your assistance!!!!!!!!!!!!

Nov 18 '05 #3

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

Similar topics

13
by: John Rebbeck | last post by:
I've got the directory f:\Company\Product set as web shared so it's got a virtual directory in the default web site on my test server's IIS. If I try to use Server.MapPath in that site it returns a...
4
by: Laphan | last post by:
Hi All Sorry to be irate, but the whole concept of Server.MapPaths really has me in a tiswas!! In order to confirm once and for all, could you please advise me on the following: 1) There...
6
by: darrel | last post by:
I have some functions that are reading/writing to the file system. As such, they use server.mapPath a lot to navigate it all. Since I'm using these functions numerous times throughout my...
7
by: benoit | last post by:
Hi, if I write this code to retrieve a folder on the server Server.mappath("/DATA") I get this error message System.InvalidOperationException: Failed to map the path '/DATA' the virtual...
14
by: Lorenzo | last post by:
Hello, I have a web application with a virtual directory in it. With 'virtual directory' i mean a folder whose physical path is different from the physical path of the application, but in which...
5
by: MichiMichi | last post by:
When using Server.MapPath on IIS 5 on my localhost everything works well. All of the following commands are executed without any error Response.Write(Server.MapPath("/app_test") & "<br>")...
4
by: vunet.us | last post by:
How to use server.mappath() parent folder correctly: Server.MapPath("../test.asp") Thank you for the hint.
3
by: rn5a | last post by:
Server.MapPath returns the physical file path that corresponds to the specified virtual path whereas Request.MapPath maps the specified virtual path to a physical path. Assuming that a file named...
6
by: withers | last post by:
If I run Server.MapPath("/") on my operational Internet server I get, correctly, the physical path to the directory my page is in (d:\.... \...\htdocs). If I run Server.MapPath("/") on my...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have one line code in my program, occasionaly I will receive the following error: "The Path parameter for the MapPath method did not correspond to a known path" ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
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...

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.