1

以下是我在 globle.asax.cs 文件上的代码:

    public static void RegisterRoutes(RouteCollection routeCollection)
    {            
        routeCollection.MapPageRoute("Account", "home", "~/Default.aspx");
        routeCollection.MapPageRoute("logout", "account", "~/Account.aspx");
        routeCollection.MapPageRoute("Doccat", "dcat/{Id}", "~/Documents.aspx");
    }

这适用于前两条路由并提供以下 URL: http://localhost.com/home http://localhost.com/about

最后一个使用我的自定义类别 ID 提供以下 URL: http ://localhost.com/dcat/1

到目前为止还不错,但是当我有“http://localhost.com/dcat/1”这个 URL 时,它会将 /dcat 作为一个文件夹,并且所有链接都进入该网站的目录中。例如 , http ://localhost.com/home更改为http://localhost.com/dcat/home ,这会影响站点中图像、css 和所有的所有路径。

请任何人帮助我,这现在太成问题了。

4

0 回答 0