Results 1 to 2 of 2

Thread: ASP.Net Custom Control **Resolved**

  1. #1

    Thread Starter
    Frenzied Member blindlizard's Avatar
    Join Date
    Feb 2001
    Location
    Austin, TX - United States of America
    Posts
    1,141

    Thumbs up ASP.Net Custom Control **Resolved**

    I have made a custom control with C# called SideNav.dll This control needs to open an XML file in my site and create the side navigation bar. It is all fine, but how can I tell the control where the XML file is? I have the control in a folder called bin inside the virtual folder in IIS and the XML file is in a folder called XML

    Here is the structure:
    C:\Inetpub\wwwroot\mySite\Default.aspx
    C:\Inetpub\wwwroot\mySite\bin\SideNav.dll
    C:\Inetpub\wwwroot\mySite\xml\SideNav.xml

    In my aspx file I call the control like this:
    <%@ Register TagPrefix="SideStuff" Namespace="myControl.Side" Assembly="SideNav" %>
    <SideStuff:SideNav SelectedOption="Home" runat=server/>

    I could pass "C:\Inetpub..." to a property of the control, but what if it changes when I move hosting? Can the control know where the website is on the server and just open the XML file from the correct folder? Right now the error says cannot find C:\WINNT\system32\xml\SideNav.xml
    Last edited by blindlizard; Feb 26th, 2003 at 05:36 PM.
    I drink to make other people more interesting!
    [vbcode]On Error GoTo Bar[/vbcode]
    http://www.monsterlizard.com

  2. #2

    Thread Starter
    Frenzied Member blindlizard's Avatar
    Join Date
    Feb 2001
    Location
    Austin, TX - United States of America
    Posts
    1,141
    Ok, I answered it myself. I just need to use Page.Server.MapPath()
    xmlpath = Page.Server.MapPath("xml\\SideNav.xml");
    I drink to make other people more interesting!
    [vbcode]On Error GoTo Bar[/vbcode]
    http://www.monsterlizard.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width