473,796 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.MyWebsi te.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 1461
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( "MyDataFold er") 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*******@nosp am.com> wrote in message
news:Xn******** *************** **********@207. 46.248.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.MyWebsi te.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*******@nosp am.com> wrote in message
news:Xn******** *************** **********@207. 46.248.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.MyWebsi te.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
14331
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 path within c:\Inetpub\wwwroot rather than the real path. Can anyone please tell me why this isn't working? Regards, John
4
1930
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 is no difference in putting '/' or '\' in the Server.MapPath param, eg Server.MapPath("/fred/test.asp") or Server.MapPath("\fred\test.asp") -
6
1607
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 application, I thought I'd move these into their own .vb class file and reference them that way. The catch is when moving these scripts over, 'Server.MapPath' turns into an error "Name 'server' is not declared"
7
3393
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 folder for my webApp is not situated in Inetpub, nor is the DATA folder that I would like to retrieve
14
12731
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 Web Sharing is active. For example: my application is in "C:\Inetpub\wwwroot\MyApp", the Virtual folder is in "C:\VirtualFolder", and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
5
9626
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>") Response.Write(Server.MapPath("app_test") & "<br>") Response.Write(Server.MapPath("~") & "<br>") However, running the first statement on via the internal Visual Studio 2005 Server I receive an error for
4
7195
by: vunet.us | last post by:
How to use server.mappath() parent folder correctly: Server.MapPath("../test.asp") Thank you for the hint.
3
15070
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 Hello.aspx resides in C:\Inetpub\wwwroot\MyFolder, the output of both Response.Write(Server.MapPath("Hello.aspx")) & Response.Write(Request.MapPath("Hello.aspx"))
6
7948
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 intranet server, my localhost, I get c:\inetpub\wwwroot, but my webpages are NOT in this folder, they are in c:\webtest. How to I establish the correct physical root on my intranet server?
3
4136
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" Path=Server.MapPath(sCertPath & "\" & order_id & ".pdf") I am wondering what is happening since every time I check my error log, the
0
9673
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
9524
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
10449
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...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5440
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
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
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
2924
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.