正确的进行网址连接code空格字符 [英] Properly url encode space character

查看:132
本文介绍了正确的进行网址连接code空格字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用HttpUtility.UrlEn code到EN code,它在路径中使用的任何价值。

I use HttpUtility.UrlEncode to encode any value that is used in a route.

我已经解决了编码正斜杠的问题。新的问题,我现在已经是空格。一个空间连接codeD +为

I already solved an issue with encoding forward slashes. The new problem I have now is with spaces. A space is encoded as + .

本工程对VS集成Web服务器,但我在IIS7有一个问题,它与Windows Server 2008上。
如果我有网址的http://本地主机/首页/ / asdas + sdasd

This works on the VS integrated Webserver, but I have an issue with it in IIS7 on Windows Server 2008. If I have the URL http://localhost/Home/About/asdas+sdasd

我得到的错误404.11 - 请求包含双转义序列

I get the error 404.11 - Request contains double escape sequence.

我知道我可以只是%20替换空间,但我不想去计较propper编码自己。有没有准备好使用UrlEn codeR为MVC了吗?

I know I can just replace the space by "%20", but I dont want to care about propper encoding myself. Is there any ready to use UrlEncoder for MVC out there?

推荐答案

恩coded到20%使用 HttpUtility.UrlPathEn code

' ' encoded to %20 use HttpUtility.UrlPathEncode.

这篇关于正确的进行网址连接code空格字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆