Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find a virtual/ relative path to a dependant file 1

Status
Not open for further replies.

skitty123

Technical User
May 4, 2004
56
US
I have some crystal reports (.rpt files ) currently on the C:\ of my development machine. so the paths to the report are hard coded as
reportViewer.ReportSource = "C:\<my report>.rpt"

when I deploy my application, I assume I will have to change all the hardcoded paths again... It does not sound like good practice, so I was wondering if there is any way to set a virtual path to my report files? or a function to find the file given its name from a relative path maybe?

using VS .NET 2003, C#, ASP and Crystal Reports 8.1
Thx
 
Skitty123,
Save your *.rpt files to a folder within your website's root folder (instead of the C drive), and use the MapPath functions. For instance, assumming that you have a folder within your website's root that is called Reports, you could write the following:
Code:
repotViewer.ReportSource = 
   [COLOR=blue]this[/color].MapPath("Reports\\[YourReport].rpt");
Hope this helps!

JC

Friends are angels who lift us to our feet when our wings have trouble remembering how to fly...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top