asp.net - How to prevent HTML code in a literal inside a DIV from affecting outer page styles -


I have a page (which uses a master page), in which there is a lexical control in the DIV, in which I Loading an HTML I have no control over source from a database record (HTML comes from MS Word document) My page looks good unless I literally load the document. Then some elements related to the master page affect their style. I think there are CSS styles in the document which I am loading which is affecting the master page elements.

How can I separate the external page from HTML I am loading?

Here is a part of the page (external) containing:

  & lt; Tr & gt; & Lt; Td colspan = "4" & gt; & Lt; Div id = "sowDiv" style = "overflow: scroll; width: 800; height: 500px" & gt; & Lt ;! - Literal control loads MS Word HTML source - & gt; & Lt; ASP: literal runat = "server" id = "sowLiteral" & gt; & Lt; / ASP: Literary & gt; & Lt; / Div & gt; & Lt; / TD & gt; & Lt; / TR & gt;   

Thanks in advance.

IFrame in conjunction with a HTT handler.

  & lt; Tr & gt; & Lt; Td colspan = "4" & gt; & Lt; Iframe src = "GetContent.ashx? Id = <% = id%>" Style = "border: 0px;" Height = "500px" width = "800px" & gt; Loading ... & lt; / Iframe & gt; & Lt; / TD & gt; & Lt; / TR & gt;   

The Web In the config, under the HTTP handler, you will need to add an HTC Handler for:

  & lt; Action = "GET" add path = "GetContent.ashx" type = "MyApp.ContentHandler" />   

The HTC Handler will return the HTML to your Word document (from the database):

  Namespace My App {Public category content handler: IHttpHandler {public void ProcessRequest (HTTP Contact Reference) {// It requires some better error management in terms of the int id = (int). Request .QueryString.Get ("id"); // Get the content from database string content = GetContentById (ID); // Display content reference. Response. Write (content); Context.Response.End (); } Public Hair IRUBL ({return false};}}}}   

To ensure that some additional security around the HD handler will be advised that unauthorized users Id can not be changed to return any content, but it should serve as a good starting point.

(Note on one hand, if you have any data from the session for authentication Receipt Do not require, do not add IRheadOnlySessionState at http handler so that it can access the session).

Comments