User-1956403626 posted
using (StreamWriter sw = new StreamWriter(@path + "\\" + name + ".rki", false))
{
you are trying to write file concurrently. Each asp.net thread from incoming request is trying to access the file.
Thread.Sleep will defer incoming threads by 1 second. Things might get messed up if it took more than a second.
These could help you out.
http://stackoverflow.com/questions/3507770/write-to-a-file-from-multiple-threads-asynchronously-c-sharp
http://forums.asp.net/t/1719966.aspx?Write+Text+file+Concurrently
Personally, I wud store MD5 or hash of incoming dt and compare it next time before saving it to file.
public static void WriteDataToFile(DataTable dt, string name)
For reasonably incoming requests I've found high I\O to be blocking.