From bbb7046925ee2c3979247d10eb4485d730248275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B6=9B?= Date: Thu, 25 Apr 2019 11:01:09 +0800 Subject: [PATCH] UrlEncode post url within Redirect method in blogging module Error "InvalidOperationException: Invalid non-ASCII or control character in header" when url contains none ASCII characters, see AspNetCore issue [4919](https://github.com/aspnet/AspNetCore/issues/4919) --- .../src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs index 468d46decd..976f78b7d1 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs @@ -54,7 +54,7 @@ namespace Volo.Blogging.Pages.Blog.Posts var postWithDetailsDto = await _postAppService.CreateAsync(ObjectMapper.Map(Post)); //TODO: Try Url.Page(...) - return Redirect(Url.Content($"~/blog/{blog.ShortName}/{postWithDetailsDto.Url}")); + return Redirect(Url.Content($"~/blog/{blog.ShortName}/{WebUtility.UrlEncode(postWithDetailsDto.Url)}")); } public class CreatePostViewModel