473,662 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server.MapPath question

In my code I have this line of code....
CrystalReportVi ewer1.ReportSou rce =
Server.MapPath( "CrystalReportS ummary.rpt")

I moved the file, CrystalReportSu mmary.rpt, and I get an error.

The value for Server.MapPath( "CrystalReportS ummary.rpt") is the old path,
not the new one.

Is this not supposed to be dynamic? How can I correct this?
Thanks
Oct 14 '05 #1
1 1330
Server.MapPath just transforms a "URL" path into a physical path. It doesn't
care where the file is or even if a file named this way exists.
Server.MapPath( "file.txt") will just return a path to this file (wether it
exists or not) relative to the directory of the currently executing page.

You'll have to fix the path in Server.MapPath such as
Server.MapPath( "~/myreports/CrystalReportSu mmary.rpt").

See the doc for details...

--

Patrice

"Craig" <No****@hotmail .com> a écrit dans le message de
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
In my code I have this line of code....
CrystalReportVi ewer1.ReportSou rce =
Server.MapPath( "CrystalReportS ummary.rpt")

I moved the file, CrystalReportSu mmary.rpt, and I get an error.

The value for Server.MapPath( "CrystalReportS ummary.rpt") is the old path,
not the new one.

Is this not supposed to be dynamic? How can I correct this?
Thanks

Oct 14 '05 #2

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

Similar topics

7
1743
by: Dave | last post by:
I have two sites: www.site_A.com & www.site_A_news.com Site_A is in d:\webs\site_a & uses an Access DB in d:\webs\site_a\data\db.mdb Site_A_news is in d:\webs\site_a\site_a_news also requires access to that Access Database.
4
1924
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") -
5
3599
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an instruction document (not data based) - same as using an xml web control. The resulting html is on the client? but what about the server side of things? Trying to figure out how to change and save the xmlDocument. It I put a button OUTSIDE of the...
3
4503
by: Jon | last post by:
I'm calling Server.MapPath from global.asa through this line of code: Application("reports_dir") = Server.MapPath("Reports") The web application opens on a testing web server (not mine) at this mapped drive: M:\ And at this browser URL: http://mrs2/P2M/login.aspx I expected MapPath to map a path on the server where the application's
6
1600
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"
1
314
by: Craig | last post by:
In my code I have this line of code.... CrystalReportViewer1.ReportSource = Server.MapPath("CrystalReportSummary.rpt") I moved the file, CrystalReportSummary.rpt, and I get an error. The value for Server.MapPath("CrystalReportSummary.rpt") is the old path, not the new one. Is this not supposed to be dynamic? How can I correct this?
11
2250
by: brett | last post by:
I use two test servers and one production. I have a Utilities class that holds many of the links used through the site. One of the variables in this class is assigned the domain name. I need to automatically set this value depending on the server I'm on. The domain can be similar to any of the following depending on the server: - abc.com - 190.168.2.100 - 190.168.2.109
1
3806
by: gujarsachin2001 | last post by:
Hello friends, I have one folder Named as MainFolder on server. I have one more folder named as subfolder inside tht main folder.Now I want to save some pictures in tht folder but at runtime I m not getting correct virtual path of tht folder. As Server.MapPath() & MapPath methods returns physical path.So How I can Access tht folder independent of where my application is insatlled. I have used following metthods but it doesnt work,
4
7183
by: vunet.us | last post by:
How to use server.mappath() parent folder correctly: Server.MapPath("../test.asp") Thank you for the hint.
0
8432
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
8344
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
8857
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
7367
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
5654
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
4180
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...
1
2762
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
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
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.