title: Replacing delimiter characters in file path
body: <p>I'm developing a C# web application in VS 2008.  I let the user select an input file and then I store the file path in a string variable.  However, it stores this path as <code>"C:\\folder\\..."</code>.  So my question is how do I convert this file path into single "\"?  </p>
  
  <p>Thank you guys for all your helps!  Please forgive me as I am a newbie to ASP.NET development.  This is more of my code in context.  First I want to see if the directory exists.  I guess I don't have to check this if I check if the file exists.  But this should still work right?  And currently my "path" string variable is not showing up the way I need it to.  I'm not sure how to formulate this statement.  Eventually I want to execute the ReadAllText statement (see the last line).</p>
  
  <pre><code>protected void btnAppend_Click(object sender, EventArgs e)
  {
      string fullpath = Page.Request.PhysicalPath;
      string fullPath2 = fullpath.Replace(@"\\", @"\");
  
      if (!Directory.Exists(fullpath2))
      {
      string msg = "&lt;h1&gt;The upload path doesn't exist: {0}&lt;/h1&gt;";
      Response.Write(String.Format(msg, fullpath2));
      Response.End();
  }
      string path = "@" + fullpath2 + uploadFile.PostedFile.FileName; 
  
      if (File.Exists(path))
      {
          // Create a file to write to.
          try
          {
              StreamReader sr = new StreamReader(path);
              string s = "";
              while(sr.Peek() &gt; 0)
                  s = sr.ReadLine();
              sr.Close();
          }
          catch (IOException exc)
          {
              Console.WriteLine(exc.Message + "Cannot open file.");
              return; 
          }
      }
  
      if (uploadFile.PostedFile.ContentLength &gt; 0)
      {
  
          inputfile = System.IO.File.ReadAllText(path);
  </code></pre>