You cannot use string.replace..and assign one line, you cannot manipulate. To do this, we use the string builder.here - my example. In the html page I add [Name], which is replaced by Name.make sure [Name] is unique, or u can give any unique name
string Name = txtname.Text; string contents = File.ReadAllText(Server.MapPath("~/Admin/invoice.html")); StringBuilder builder = new StringBuilder(contents); builder.Replace("[Name]", Name); StringReader sr = new StringReader(builder.ToString());
source share