相关疑难解决方法(0)

URL中的URL编码斜杠

我的地图是:

routes.MapRoute(
   "Default",                                             // Route name
   "{controller}/{action}/{id}",                          // URL with params
   new { controller = "Home", action = "Index", id = "" } // Param defaults
);
Run Code Online (Sandbox Code Playgroud)

如果我使用URL http://localhost:5000/Home/About/100%2f200,则没有匹配的路由.我将URL更改为http://localhost:5000/Home/About/100然后再次匹配路由.

有没有简单的方法来处理包含斜杠的参数?其他转义值(空格%20)似乎有效.

编辑:

编码Base64对我有用.它使URL变得丑陋,但现在还可以.

public class UrlEncoder
{ 
    public string URLDecode(string  decode)
    {
        if (decode == null) return null;
        if (decode.StartsWith("="))
        {
            return FromBase64(decode.TrimStart('='));
        }
        else
        {
            return HttpUtility.UrlDecode( decode) ;
        }
    }

    public string UrlEncode(string encode)
    {
        if (encode == null) return null;
        string encoded = …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc urlencode asp.net-mvc-routing

56
推荐指数
5
解决办法
6万
查看次数

如果%2F是JBOSS中GET URL的一部分,则会收到HTTP 400错误

每当有一个%2F十六进制代码的URL /发布到我的JBOSS服务器时,我收到一个错误:

HTTP 400 Bad Request error message. 
Run Code Online (Sandbox Code Playgroud)

这是URL:

http://localhost:8080/application/**abc%2Fhi**?msg=hello"
Run Code Online (Sandbox Code Playgroud)

如果我%2F从URL中删除链接工作正常.

%2F必须是URL的一部分,不能是请求参数.

jboss http

25
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net-mvc ×1

asp.net-mvc-routing ×1

c# ×1

http ×1

jboss ×1

urlencode ×1