DEV Community

Cover image for Vietnamese Alphabet rewrite to FriendlyUrl for .Net Core and .Net Framework
Dương Thuần Bảo
Dương Thuần Bảo

Posted on

Vietnamese Alphabet rewrite to FriendlyUrl for .Net Core and .Net Framework

Rewrite Url from VietnameseString for Web Application (WebPage, MVC, .Net Core, .Net Framework)

Project site:

GitHub logo baoduong-dev / VietnameseUrlRewrite

Rewrite Friendly-Url from VietnameseString for Web Application (WebPage, MVC, .Net Core, .Net Framework)

Using:

UrlWrite.Url(string);
Enter fullscreen mode Exit fullscreen mode

Example:

public IActionResult Index()
{
    string a = "Đây là Url bài viết số n";
    string b = UrlWrite.Url(a);
    return Content(b);
    /// Result: "day-la-url-bai-viet-so-n"
}
Enter fullscreen mode Exit fullscreen mode

How do I use it?

  1. Install "VietnameseUrlRewrite" via NuGet
Install-Package VietnameseUrlRewrite -Version 1.0.1
Enter fullscreen mode Exit fullscreen mode

2, In your controller code or Razor page, call UrlWrite.Url(string) if you want to convert string to url.

Using .Net Standard 2.0

Use .net Standard should be suitable for all projects .Net Framework and .Net Core

Authors

License

Licensed under the MIT License.

Top comments (2)

Collapse
 
andy_preston profile image
Andy Preston

What's the main motivation to using this?

I guess some words in the URL lose meaning, however it becomes easier to type.

I assumed that the Vietnamese characters were valid in the URL specification.

Collapse
 
baoduongdev profile image
Dương Thuần Bảo

Vietnamese has accents for letters. You need to remove it, make it Latin, and be Google-friendly