Adding HTML page Content into SharePoint Page(.aspx) / Showing HTML content in SharePoint page(.aspx)


Read HTML file from SharePoint document library and show it inside the SharePoint page (.aspx)(Read all html files and show into custom WebPart, Onclicking the document link it should redirect to custom page where we will display the HTML file).

We tried the below code to display to HTML content inside the SharePoint page (.aspx)


StreamReader srHTML = null;
string strHTML = string.Empty;
SPFile spfile = SPContext.Current.Web.Lists.TryGetList("Documents").GetItemById(45).File;
srHTML = new StreamReader(spfile.OpenBinaryStream());
strHTML = srHTML.ReadToEnd();

ltrHTMLContent.Text = strHTML;

<Div style="height:500px">
        <asp:Literal ID="ltrHTMLContent" runat="server"></asp:Literal>

The above works very well!


Popular posts from this blog

Using External Content Types with Stored Procedures with Input Parameters

HTTPS Site InfoPath Issue : You do not have permissions to access a web service that provides data required for this form to function correctly

Windows 7 Blue Screen because of ConnectiFy