Programming Tutorials

Display the HTML content in your C# view

By: Niraj in csharp Tutorials on 2023-03-29  

To display the HTML content in your success view after parsing, you can use the Html.Raw method in Razor syntax. Html.Raw method is used to render HTML markup to the page without encoding the markup.

Here's an example of how you can use it in your success view:

@model YourModel
    Layout = null;

<h1>Your Success View</h1>


In the above code, the Html.Raw method is used to render the contents of Model.response without encoding the HTML tags. This should display the parsed HTML content in the success view instead of the raw HTML code.

Note: Be careful when using Html.Raw as it can potentially lead to cross-site scripting (XSS) vulnerabilities if you are not careful about the input you are rendering. Make sure to validate and sanitize the input before rendering it in your view.

Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in csharp )

Latest Articles (in csharp)