page.MaphPath problem

  • Thread starter Thread starter Tascien
  • Start date Start date
T

Tascien

I have a userControl placed in a directory like this:

/usercontrols/myUserControl.ascx
/usercontrols/controlsList.txt
/index.aspx

'index.aspx' is using 'myUserControl.ascx'
'myUserControl.ascx' is using page.MapPath("controlsList.txt") to open
the file, and the process is failing because the file cannot be found.
the system is looking for:

\\webshare\controlsList.txt
instead of
\\webshare\usercontrols\controlsList.txt

is this how microsoft designed this to be? i know i can change the
folder to match, but i want to make sure that there isn't any other
programed way...
 
this is as expected. It's all relative to the PAGE that has the controls.
Make all calls relative to the root and you are ok, or what I do is
something like this

root
root/pages/
root/controls/
root/.......blah/

Then I make ALL my calls/paths like this

.../pages/pageName.aspx
or
.../controls/controlName.ascx
 
Back
Top