We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Find a folder path from solution explorer in a web application

ASINGH1974 asked
Medium Priority
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.
Watch Question

Anurag AgarwalPython Developer

In NameSpace System.IO Use
FILE.Exists("FIle Path")
this will return bool value
Anurag AgarwalPython Developer

Sorry, you need to check for folders. Use this

Directory.Exists("Folder path")
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.