title: Default folder for the FileUpload Control in Asp.net
body: <p>I am trying to Convert Office Word Document to HTML and display it in browser in ASP.Net so my code below is working fine but the only change that i want to make is that i don't want to use the FileUpload control, instead i want to set my default location to be simply as this: C:\Mydocument\ so how can i get rid of the fileupload control and just set my default location like above?</p>
  
  <pre><code> protected void Upload(object sender, EventArgs e)
      {
        object missingType = Type.Missing;
        object readOnly = true;
        object isVisible = false;
        object documentFormat = 8;
        string randomName = DateTime.Now.Ticks.ToString();
        object htmlFilePath = Server.MapPath("~/Temp/") + randomName + ".htm";
        string directoryPath = Server.MapPath("~/Temp/") + randomName + "_files";
  
        //Upload the word document and save to Temp folder
        FileUpload1.SaveAs(Server.MapPath("~/Temp/") + Path.GetFileName(FileUpload1.PostedFile.FileName));
        object fileName = FileUpload1.PostedFile.FileName;
  
        //Open the word document in background
        ApplicationClass applicationclass = new ApplicationClass();
        applicationclass.Documents.Open(ref fileName,
                                        ref readOnly,
                                        ref missingType, ref missingType, ref missingType,
                                        ref missingType, ref missingType, ref  missingType,
                                        ref missingType, ref missingType, ref isVisible,
                                        ref missingType, ref missingType, ref missingType,
                                        ref missingType, ref missingType);
        applicationclass.Visible = false;
        Document document = applicationclass.ActiveDocument;
  
        //Save the word document as HTML file
        document.SaveAs(ref htmlFilePath, ref documentFormat, ref missingType,
                        ref missingType, ref missingType, ref missingType,
                        ref missingType, ref missingType, ref missingType,
                        ref missingType, ref missingType, ref missingType,
                        ref missingType, ref missingType, ref missingType,
                        ref missingType);
  
        //Close the word document
        document.Close(ref missingType, ref missingType, ref missingType);
  
        //Delete the Uploaded Word File
        File.Delete(Server.MapPath("~/Temp/") + Path.GetFileName(FileUpload1.PostedFile.FileName));
  
        //Read the Html File as Byte Array and Display it on browser
        byte[] bytes;
        using (FileStream fs = new FileStream(htmlFilePath.ToString(), FileMode.Open, FileAccess.Read))
        {
          BinaryReader reader = new BinaryReader(fs);
          bytes = reader.ReadBytes((int)fs.Length);
          fs.Close();
        }
        Response.BinaryWrite(bytes);
        Response.Flush();
  
        //Delete the Html File
        File.Delete(htmlFilePath.ToString());
        foreach (string file in Directory.GetFiles(directoryPath))
        {
          File.Delete(file);
        }
        Directory.Delete(directoryPath);
        Response.End();
      }
  </code></pre>