Forum Moderators: open

Message Too Old, No Replies

Code Behind Questions

Relitive File Paths and Application variables

         

lawrencephillips

9:39 am on Oct 11, 2005 (gmt 0)

10+ Year Member



I'm all new to .net.

I'm working with the code behind model in asp.net and I'm trying to figure out how to get relative filepaths.

For example, I'm trying to write my template to the page but I don't want to have:
'C:\sites\...\Templates\Template.txt'
in the code, I'd rather have:
'\Templates\Template.txt'

How do I go about doing this. Also if there are application wide variables that I wan't to be accisible to my class files where do I put them and how do I access them.

Thanks in advance

Easy_Coder

10:42 am on Oct 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well you can use server.mappath...

Consider moving your code to a User Control then just drag that control to the pages where you need it.