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>
<div>
 @Html.Raw(Model.response)
</div>

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

JavaScript must be enabled for certain features to work
* Required information
1000

Comments

No comments yet. Be the first!
(追記) (追記ここまで)
(追記) (追記ここまで)

AltStyle によって変換されたページ (->オリジナル) /