Deleting file in asp.net using c#?
<p>When I save a document file in my solution explorer, I send that doc file through mail then I am wanting to delete the document file. It is giving an error like this: <code>process being 
used by another process</code>. </p>

<p>Below please find my code:</p>

<pre><code>protected void btnsubmit_Click(object sender, EventArgs e)
    {           
        if (Label1.Text == txtverifytxt.Text)
        {
            if (rdoSevice.SelectedItem.Value == "1")
            {
                PackageType = ddlindPackages.SelectedItem.Text;
            }
            else if (rdoSevice.SelectedItem.Value == "2")
            {
                PackageType = ddlCorpPack.SelectedItem.Text;
            }
            if (ResumeUpload.PostedFile != null)
            {

                HttpPostedFile ulFile = ResumeUpload.PostedFile;
                string file = ulFile.FileName.ToString();
                FileInfo fi = new FileInfo(file);

                string ext = fi.Extension.ToUpper();
                if (ext == ".DOC" || ext == ".DOCX")
                {
                    int nFileLen = ulFile.ContentLength;
                    if (nFileLen &gt; 0)
                    {
                        strFileName = Path.GetFileName(ResumeUpload.PostedFile.FileName);
                        strFileName = Page.MapPath("") + "\\Attachments\\" + strFileName;
                        ResumeUpload.PostedFile.SaveAs(strFileName);
                    }
                    sendingmail();
                    FileInfo fi1 = new FileInfo(strFileName);
                    ResumeUpload.FileContent.Dispose();
                    Label2.Visible = true;
                    Label2.Text = "Request sent sucessfully";
                    fi1.Delete();
                    //if (File.Exists(strFileName))
                    //{
                    //    File.Delete(strFileName);
                    //}
                    ClearAll(tblOrdernow);
                    //Response.Redirect("CheckOut.aspx");
                }
                else
                {
                    Label2.Visible = true;
                    Label2.Text = "Upload only word documents..";
                }
            }
            else
            {
                Label2.Visible = true;
                Label2.Text = "Do not upload empty document..";
            }
        }
        else
        {

            Label2.Visible = true;
            Label2.Text = "Verify Image not Matched";
            Label1.Text = ran();

        }
    }
</code></pre>
