title: Getting access denied when try to delete file
body: <p>I'm getting access denied whenever I try to delete a file after finishing reading it at <code>C:\inetpub\wwwroot\Project\temp\</code>. I Close() and Dispose() the StreamReader properly already? I also gave full permission for NETWORK SERVICE account? Can anyone help me?</p>
  
  <pre><code>reader = new StreamReader(path + fileName);
  DataTable dt = new DataTable();
              String line = null;
              int i = 0;
  
              while ((line = reader.ReadLine()) != null)
              {
                  String[] data = line.Split(',');
                  if (data.Length &gt; 0)
                  {
                      if (i == 0)
                      {
                          dt.Columns.Add(new DataColumn());
                          foreach (object item in data)
                          {
                              DataColumn c = new DataColumn(Convert.ToString(item));
                              if (Convert.ToString(item).Contains("DATE"))
                              {
                                  c.DataType = typeof(DateTime);
                              }
                              else { c.DataType = typeof(String); }
                              dt.Columns.Add(c);
                          }
                          dt.Columns.Add(new DataColumn("CreatedDate", typeof(DateTime)));
                          i++;
                      }
                      else
                      {
                          DataRow row = dt.NewRow();
                          row[0] = "";
                          for (int j = 0; j &lt; data.Length; j++)
                          {
                              if (dt.Columns[j + 1].DataType == typeof(DateTime))
                              {
                                  row[j + 1] = Convert.ToDateTime(data[j]);
                              }
                              else
                              {
                                  row[j + 1] = data[j];
                              }
                          }
                          row[data.Length + 1] = DateTime.Now.ToString();
                          dt.Rows.Add(row);
                      }
                  }
              }
              DataAccess dataAccess = new DataAccess(Constant.CONNECTION_STRING_NAME);
              dataAccess.WriteBulkData(dt, Constant.TABLE);
              reader.Close();
              reader.Dispose();
              File.Delete(path);
  </code></pre>