i want to change and save a html file at runtime using xmltextreader. it works fine on local host but after uploading website i get this error:

The underlying connection was closed: The connection was closed unexpectedly.

on:

Code:
         File.Copy(source, pathToNewPost);
  
         XmlTextReader txReader = new XmlTextReader(pathToNewPost);
         XmlDocument xmlDoc = new XmlDocument();
         xmlDoc.Load(txReader);<------