Getting Original Path from FileStream

The FileStream's Name property.

See documentation in MSDN


You can use fs.Name to get the path.


Use FileInfo-Class for getting the path.

var fileStream = File.OpenRead(fileName);
var fileInfo = new FileInfo(fileName);

Settings.Default.ThePath = fileInfo.DirectoryName;
Settings.Default.Save();