Hi,
An HTTP Request returns me an error in HTML format. Please see img001. This image was capture in debug mode in Visual Studio.
When I want to show a MessageBox or a Label with this HTML, appears like in img002.
Thank you!
The HTML text is:
<!doctype html><html lang="en"><head><title>HTTP Status 401 – Unauthorized</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 401 – Unauthorized</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> Unauthorized</p><p><b>Description</b> The request has not been applied because it lacks valid authentication credentials for the target resource.</p><hr class="line" /><h3>Apache Tomcat/8.5.65</h3></body></html>
Hi Alejandro,
Thank you for the provided images.
The provided HTML contains tags that are not supported. You can check which tags are supported in the Supported Tags section of HTML-like Text Formatting article. In your case, you can modify the HTML code like the following one.
private void radButton1_Click(object sender, EventArgs e)
{
var htmlText = "<html><b>HTTP Status 401 – Unauthorized</b><p><b>Type</b> Status Report</p><p><b>Message</b> Unauthorized</p><p><b>Description</b> The request has not been applied because it lacks valid authentication credentials for the target resource. </p> " +
"<p><b>Apache Tomcat/8.5.65</b></p></html>";
RadMessageBox.Show(this, htmlText, "Title", MessageBoxButtons.YesNo, RadMessageIcon.Question);
}
Here is the result on my side.
Another approach could be instead of using RadMessageBox you can use a custom Form. You can design it similar to a message box. You can place two buttons and the bottom and for the HTML you can consider using RadRichTextEditor control which supports more HTML tags.
Regards,
Dinko
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.