Find a folder path from solution explorer in a web application

Posted on 2009-02-12
Last Modified: 2012-05-06
Hi experts,

in my web application in solution explorer i have 5 folders like product,order,item,purchase,sell
and inside each folder there is xml like as

- <Connection>
- <databaseserver name="test">

Now i have a drop down at front end in there are name like product,item,order.
on selection of any item i have to check weathere that folder exists or not.
and if exists then find the databasename,servewr,uid and password by using coding

pls help me ASAP.
Question by:ASINGH1974
    LVL 11

    Expert Comment

    In NameSpace System.IO Use
    FILE.Exists("FIle Path")
    this will return bool value
    LVL 11

    Expert Comment

    Sorry, you need to check for folders. Use this

    Directory.Exists("Folder path")
    LVL 16

    Accepted Solution

    Try this
    <asp:DropDownList ID="ddlFolders" runat="server" OnSelectedIndexChanged="ddlFolders_SelectedIndexChanged">
        <asp:ListItem Value="product" Text="product"></asp:ListItem>
        <asp:ListItem Value="order" Text="order"></asp:ListItem>
        <asp:ListItem Value="item" Text="item"></asp:ListItem>
        <asp:ListItem Value="purchase" Text="purchase"></asp:ListItem>
        <asp:ListItem Value="sell" Text="sell"></asp:ListItem>
        protected void ddlFolders_SelectedIndexChanged(object sender, EventArgs e)
            if(System.IO.Directory.Exists(Server.MapPath("~/" + ddlFolders.SelectedValue)))
                System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
                xmlDoc.Load(Server.MapPath("~/" + ddlFolders.SelectedValue));
                string databaseserver = xmlDoc.SelectSingleNode("//databaseserver").Attributes["name"].Value;
                string server = xmlDoc.SelectSingleNode("//server").Value;
                string database = xmlDoc.SelectSingleNode("//database").Value;
                string uid = xmlDoc.SelectSingleNode("//uid").Value;
                string password = xmlDoc.SelectSingleNode("//password").Value;

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Specialist

    HTML5 development skills are critical to all developers. HTML5 is the foundation to almost any development process. That's why business, design studios, development shops and other organizations need HTML5 developers. Get your foot in the door as a HTML5 specialist.

    Introduction HyperText Transfer Protocol ( or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
    New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
    This video teaches users how to migrate an existing Wordpress website to a new domain. provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now