Edi Wang

.NET and Azure Developer


Building a .NET Core URL Forward Service

I recently built a URL forward service named “Link Forwarder” using .NET Core 2.2. It’s open source and currently having a preview version deployed to my subdomain “go.edi.wang”. This article will share how I built it and what I learned. To help you understand the system and walk through the code, please check my GitHub repository for this project: https://github.com/EdiWang/LinkForwarder The …

.NET Core WebUtility.UrlEncode or HttpUtility.UrlEncode

When we are dealing with URL encode in .NET Core 2.1, there are two APIs: System.Net.WebUtility.UrlEncode and System.Web.HttpUtility.UrlEncode. What's the difference between them? And which one should we prefer to use? I have done some research today, here's my findings. 1. Test Results First, let's see some tests. I've tested 2 couples of the same method between WebUtility class and HttpUtility …
.NET URL Encoding

How to Redirect Old Domain URL to New Domain in IIS

When you change the domain name for your website, you are definitely going to solve the migration problem. You cannot just stop DNS on your old domain, because this will cause your indexed pages to be deleted by search engines. The correct way is to tell the search engine that you have a new domain name now, which is when the user accesses an old URL, redirect it to the new URL. Take my blog …


今天在改博客系统的一个Bug的时候,程序里用了Session,结果一跑就报错:只有在配置文件或 Page 指令中将 enableSessionState 设置为 true  时,才能使用会话状态。还请确保在应用程序配置的<configuration>\<system.web>\<httpModules>节中包括  System.Web.SessionStateMod 或自定义会话状态模块。然而用VS自带的Web Server调试一点问题都没有。唯独在IIS下跑的时候老报错,错误语句就是那行用了Session的程序。唯一的区别就是VS下调试时,URL没有重写。于是我回到IIS上,用完整的URL试了下,果然木有问题。 我所使用的是URLRewriter.dll,似乎是当年微软提供的,经过一番查找,似乎有很多人和我有同样的问题,不管他们用的是不是URLRewriter.dll。 奇怪的是,并不是 …