473,327 Members | 2,118 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,327 software developers and data experts.

Server.MapPath question

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?
Thanks
Oct 14 '05 #1
1 1303
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/CrystalReportSummary.rpt").

See the doc for details...

--

Patrice

"Craig" <No****@hotmail.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP09.phx.gbl...
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?
Thanks

Oct 14 '05 #2

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

Similar topics

7
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...
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...
5
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...
3
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...
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...
1
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...
11
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...
1
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...
4
by: vunet.us | last post by:
How to use server.mappath() parent folder correctly: Server.MapPath("../test.asp") Thank you for the hint.
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.