I have a text file which have list of links like this :
<A title=Accept href="https://www.google.com/url?q=https%3A%2F%2Fregister.eragenx.com%2Freferral%3Freferrer%3Demail%26invitationToken%3D1f7ae07e4cb1ed96a7fc5f6de10376d9%26email%3Dlovessoumi.tra123456789soumit90%2540gmail.com&sa=D&sntz=1&usg=AFQjCNGdIeh6LFs4H5TvysbSV7DjUk2Tuw" target=_blank>Sign Up Now For Free.</A>
with my program and on the event of button click i want to edit each line of file like :
https://register.eragenx.com/referral?referrer=email&invitationToken=fd78d9fdf6281e033b389cb14e118f85&email=lovesleeping1234567.8sleepin.g97%40gmail.com
This is what I am trying, but it dosent seem to work, what am I doing wrong?
public void editline()
{
string[] lines = File.ReadAllLines("link.txt");
foreach (var line in lines)
{
line.Substring(51,171);
line.Replace("%3A", ":");
line.Replace("%2F","/");
line.Replace("%3F","?");
line.Replace("%3D" , "=");
line.Replace("%26","&");
}
File.WriteAllLines("output.txt",lines);
}
I have also tried this :
public void editline()
{
string[] lines = File.ReadAllLines("link.txt");
foreach (var line in lines)
{
HttpUtility.UrlDecode(line.Substring(51, 171));
}
File.WriteAllLines("output.txt", lines);
}
and this :
public void editline()
{
string parsedLine = null;
string[] lines = File.ReadAllLines("link.txt");
foreach (var line in lines)
{
parsedLine = line.Substring(51, 171);
parsedLine = line.Replace("%3A", ":");
parsedLine = line.Replace("%2F", "/");
parsedLine = line.Replace("%3F", "?");
parsedLine = line.Replace("%3D", "=");
parsedLine = line.Replace("%26", "&");
}
File.WriteAllLines("output.txt", lines);
}
but the output is same as the link from link.txt the method is making no change in output.txt
please help