hi
i want to fetch and display html page from db on click in a html page from ajax web method. Not able to display html page in a iframe and multiview.
Sample HTML
<html><head><title>DMC-DO228-AAA-00-00-00-01A-000A-A.htm</title>
</head><body>
<p> just to check </p>
<a id="5" class="anchorLink" href="#">just to check</a>
<a id="6" class="anchorLink" href="#">just to check</a>
</body>
</html>
I am getting error "illegall characters in path" when I read htm as a string.
public static string getlink(int Id)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connString"].ConnectionString);
string link = "extlink";
BookTree obj = new BookTree();
DataSet ds = obj.getlink(Id);
SqlCommand cmd=new SqlCommand("select vcFilePath from tblBookNodes where iModuleId='" + Id + "'",conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
bytes = (byte[])dr["vcFilePath"];
}
string fileName = link.Replace(" ", "_") + ".htm";
DirectoryInfo strPath = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/Linking/"));
//foreach (FileInfo file in strPath.GetFiles())
//{
// file.Delete();
//}
string path = strPath + fileName;
var doc = new HtmlDocument();
string html = Encoding.UTF8.GetString(bytes);
doc.LoadHtml(html);
StringWriter sw = new StringWriter();
var hw = new HtmlTextWriter(sw);
StreamWriter sWriter = new StreamWriter(html);
sWriter.Write(sw.ToString());
doc.Save(sWriter);
sWriter.Close();
string fileContents = html;
System.IO.File.WriteAllText(html, fileContents);
return fileContents;
}