- [DEVEXPRESS] Chia sẻ source code cách tạo biểu đồ sơ đồ tổ chức công ty Org Chart trên Winform C#
- [C#] Hướng dẫn tạo Auto Number trên Datagridview winform
- [DATABASE] Hướng dẫn tạo Procedure String Split in Mysql
- [C#] Thiết lập dấu (,) hay dấu (.) ở định dạng số đúng với định dạng số Việt Nam
- [C#] Chia sẻ source code Game Spin Lucky Wheel
- [C#] Hướng dẫn Encode and Decode HTML
- Danh sách tài khoản ChatGPT miễn phí - Hướng dẫn tạo tài khoản Chat Open AI GPT tại Việt Nam
- [C#] Hướng dẫn thay đổi giao diện ứng dụng Winform theo giao diện của Windows
- [VB.NET] Hiệu ứng Acrylic, Mica, Tabbed Blur Effect trên Winform
- [DEVEXPRESS] Hướng dẫn sử dụng HTML Template trên Combobox Edit
- [C#] Chia sẻ source code Orange Rain in Winform
- [DEVEXPRESS] Hướng dẫn sử dụng HTML Template trên XtraMessageBox Winform Devexpress 22.2.3
- [DEVEXPRESS] Hướng dẫn sử dụng HTML and CSS Code Viewer trên Winform
- [C#] Number Effect Counter up and down in winform
- [C#] Hướng dẫn Supend and Resume Process ID in Winform
- [C#] Hiển thị line number trên Richtextbox Winform
- [C#] Fake Blue Screen BSOD in winform
- [C#] Chia sẽ code demo sử dụng Async Parallel Foreach and For in Winform
- [C#] Sử dụng ActionBlock run X task at time winform
- [C#] Hướng dẫn sử dụng Property Grid để lưu và tải lại thông tin cấu hình user trên winform
[C#] Hướng dẫn Encode and Decode HTML
Xin chào các bạn, bài viết hôm nay mình tiếp tục hướng dẫn cách giải mã và mã hóa (Encode và Decode HTML) trên lập trình C#, winform.
[C#] How to Encode and Decode HTML
Trong cấu trúc của HTML có những ký tự như "<", ">" ... những ký tự trong thẻ tag của html.
Khi các bạn thấy khi chuyển dữ liệu đi hoặc lưu trữ HTML vào database thường chúng ta sẽ mã hóa các thẻ html này để lưu vào cơ sở dữ liệu.
Giao diện demo ứng dụng:
Video hướng dẫn step by step:
Source code C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HTMLEncodeDecode
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnEncode_Click(object sender, EventArgs e)
{
var inputText = txtInput.Text.Trim();
var htmlEncode = WebUtility.HtmlEncode(inputText);
txtOutput.Text = htmlEncode;
}
private void btnDecode_Click(object sender, EventArgs e)
{
var inputText = txtInput.Text.Trim();
var htmlDecode = WebUtility.HtmlDecode(inputText);
txtOutput.Text = htmlDecode;
}
}
}
Thanks for watching!