UserControl Properties

Discussion in 'ASP .Net' started by =?Utf-8?B?Sm9u?=, May 17, 2005.

  1. 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
    =?Utf-8?B?Sm9u?=, May 17, 2005
    #1
    1. Advertising

  2. You should use Server.MapPath.

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

    it will get the actual path on your server.

    HTH,

    bill

    "Jon" <> wrote in message
    news:...
    > 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
    William F. Robertson, Jr., May 17, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. huobazi
    Replies:
    1
    Views:
    683
    David Waz...
    Jul 3, 2003
  2. Rajesh Tiwari

    Can we use a usercontrol inside a usercontrol

    Rajesh Tiwari, Aug 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    411
    Rajesh Tiwari
    Aug 12, 2003
  3. nail
    Replies:
    0
    Views:
    1,539
  4. Phl
    Replies:
    2
    Views:
    522
    =?Utf-8?B?VGFtcGEgLk5FVCBLb2Rlcg==?=
    Nov 18, 2004
  5. Fabiano
    Replies:
    2
    Views:
    598
    =?Utf-8?B?c3Jpbmk=?=
    Jun 3, 2005
Loading...

Share This Page