Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.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 C.NET4.0中的URL重写_Asp.net_C# 4.0_Url Rewriting_Url Routing - Fatal编程技术网

Asp.net C.NET4.0中的URL重写

Asp.net C.NET4.0中的URL重写,asp.net,c#-4.0,url-rewriting,url-routing,Asp.net,C# 4.0,Url Rewriting,Url Routing,以下是我在globle.asax.cs文件中的代码: public static void RegisterRoutes(RouteCollection routeCollection) { routeCollection.MapPageRoute("Account", "home", "~/Default.aspx"); routeCollection.MapPageRoute("logout", "account", "

以下是我在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/about

最后一个URL提供了我的自定义类别ID:

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


请任何人在这方面帮助我,这太麻烦了。

你能显示其中一个链接的代码吗?谢谢你的问题@ChrisGessler,我的Default.aspx和Account.aspx页面上没有代码,Documents.aspx页面上只有一行,如下所示:string id=page.RouteData.Values[id].ToString;