title: Could not find a part of the path while trying to retrieve a path in ASP.NET
body: <p>I have the following code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.IO;
  
  public partial class view4 : System.Web.UI.Page
  {
       protected void Page_Load(object sender, EventArgs e)
       {
  
          string strheadlinesid = string.Empty;
  
          if (!IsPostBack)
          {
              if (!string.IsNullOrEmpty(Convert.ToString(
                   Request.QueryString["folder"].ToString())))
              {
                  strheadlinesid = Request.QueryString["folder"].ToString();
              }
         }
  
         Response.Write("&lt;table style='width: 10px; height: 10px; margin-left: 
             100px; margin-top: 10px'&gt;");
  
          DirectoryInfo Dir = new DirectoryInfo(strheadlinesid);
  
          FileInfo[] FileList = Dir.GetFiles("*.*", SearchOption.AllDirectories);
  
          foreach (FileInfo FI in FileList)
          {
  
              Response.Write("&lt;tr&gt;");
  
              Response.Write("&lt;td&gt;&lt;a href= view3.aspx?file=" + FI.Name + "&gt; " + 
                  FI.Name + "&lt;/a&gt;&lt;/td&gt;");
              Response.Write("&lt;/tr&gt;");
          }
  
          Response.Write("&lt;/table&gt;");
  
      }
  
      private object DirectoryInfo(string p)
      {
          throw new NotImplementedException();
      }
  
  
  }
  </code></pre>
  
  <p>I'm getting the path of a directory by storing it in folder. However, when I use it to print the files from that directory, I'm getting the following error:</p>
  
  <blockquote>
    <p>Could not find a part of the path
    'C:\Users\naresh\Documents\Visual\'.</p>
  </blockquote>
  
  <p>The actual path <code>C:\Users\naresh\Documents\Visual Studio 2010\WebSites\C_Manager\Account</code>. But, the account part is changing dynamically.</p>