Browse Source

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)
pull/1048/head
杨涛 8 years ago
parent
commit
bbb7046925
  1. 2
      modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs

2
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<CreatePostViewModel,CreatePostDto>(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

Loading…
Cancel
Save