UserControl Properties

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,

I have a usercontrol with a number of public properties. A couple of these
properties are file paths (to xml files, etc). These file paths may be to any
folder in my project.

However, when setting these using xmlfile="~/thexmlfile.xml" it doesn't seem
to work. If I do a debug at the point is does the set, is coming through as
"~/thexmlfile.xml" rather than the actual application path. Why is this and
is there a work around? I've also tried doing a contect swith to a method
that would return the application path, eg
xmlfile="<%=MyAppPathMethod%>/thexmlfle.xml", but alas this didn't wotk.

Any help, would be much appreciated,

Jon
 
You should use Server.MapPath.

string XmlFile = Server.MapPath( "~/thexmlfile.xml" ).

it will get the actual path on your server.

HTH,

bill
 
Back
Top