Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 为具有%3D的URL链接重写IIS URL_Asp.net_Asp.net Mvc 3_Iis_Url Rewriting_Rewrite - Fatal编程技术网

Asp.net 为具有%3D的URL链接重写IIS URL

Asp.net 为具有%3D的URL链接重写IIS URL,asp.net,asp.net-mvc-3,iis,url-rewriting,rewrite,Asp.net,Asp.net Mvc 3,Iis,Url Rewriting,Rewrite,我遇到一个问题,有人发布了我的asp.net mvc3站点的URL,该URL在我的id参数后包含%3D,而不是等号,如下所示:。我尝试了各种重写规则,但似乎无法将URL正确重写为:。这是一个问题,因为带有%3D的URL出现404错误。如果可能的话,我想创建一个规则,用%编码将任何URL重写为正确的解码值。如果这是不可能的,我只想知道如何重写我的文章URL,以确保在文章URL中不再出现等号%3D 有人能解释一下我将如何着手创建这些重写规则吗?提前谢谢 您几乎没有选择: 编写自己的提供程序,将%3D

我遇到一个问题,有人发布了我的asp.net mvc3站点的URL,该URL在我的id参数后包含%3D,而不是等号,如下所示:。我尝试了各种重写规则,但似乎无法将URL正确重写为:。这是一个问题,因为带有%3D的URL出现404错误。如果可能的话,我想创建一个规则,用%编码将任何URL重写为正确的解码值。如果这是不可能的,我只想知道如何重写我的文章URL,以确保在文章URL中不再出现等号%3D

有人能解释一下我将如何着手创建这些重写规则吗?提前谢谢

您几乎没有选择:

  • 编写自己的提供程序,将%3D替换为=

    参考:

  • 应用程序\u BeginRequest
    中,替换路径:

    protected void Application_BeginRequest(object sender, EventArgs e)
    {
        string path = HttpContext.Current.Request.Url.PathAndQuery;
    
        // Search for %3D and replace.
        path = path.Replace("%3D","=");
    
        HttpContext.Current.RewritePath(path);
    }