Code:
string filelocation = Regex.Replace(prelocation,"\\","\\\\");
Well this is where it gets hairy.
\ - in C#, this is the escape character
\\ - in C#, this is the "\" character
\ - in regular expressions, this is the escape character
\\ - in regular expressions, this is the "\" character
Now, your C# code is passed to the regular expression library, so it's actually escaped twice!
So, what you need to pass in isn't just "\\", but "\\\\". First, "\\\\" in C# is converted to two real double slashes ("\\"). Then, those two slashes are passed to the regex library, which sees them as "\".
So this should solve your problem:
Code:
string filelocation = Regex.Replace(prelocation,"\\\\","\\\\\\\\");