Url路由HTML不呈现

时间:2014-01-05 12:20:17

标签: html asp.net asp.net-mvc webforms

我使用过Url Route但有时我觉得 HTML 代码无法呈现

这是我在 Global.asax

中的代码
void Application_Start(object sender, EventArgs e)
{   
    RegisterRoutes(RouteTable.Routes);
}

public static void RegisterRoutes(RouteCollection routeCollection)
{
    routeCollection.MapPageRoute("LogIn", "logga-in", "~/Login.aspx");
    routeCollection.MapPageRoute("Contact", "kontakt", "~/Contact.aspx");
    routeCollection.MapPageRoute("About", "om", "~/About.aspx");
    routeCollection.MapPageRoute("Job", "jobb", "~/Job.aspx");
    routeCollection.MapPageRoute("Connect", "anslut", "~/Connect.aspx");
    routeCollection.MapPageRoute("Default", "", "~/Default.aspx");
    routeCollection.MapPageRoute("Booking", "bokning/{Id}", "~/Booking.aspx");

    routeCollection.MapPageRoute("DashboardDefault", "panel/", "~/Dashboard/Default.aspx");
    routeCollection.MapPageRoute("DashboardAbout", "panel/om", "~/Dashboard/About.aspx");
    routeCollection.MapPageRoute("DashboardContact", "panel/kontakt", "~/Dashboard/Contact.aspx");
    routeCollection.MapPageRoute("DashboardLogIn", "panel/logga-in", "~/Dashboard/Login.aspx");
}

当访问aspx网站时,每个工作都很好http://www.dentalo.se/dashboard/login.aspx se enter image description here

下面的图像

尝试访问相同的网页,但使用友好的网址http://www.dentalo.se/panel/logga-in 它看起来像这样。

enter image description here 任何人都可以帮助我为什么会这样?我肯定知道javascript也没有渲染。

1 个答案:

答案 0 :(得分:3)

您的css样式表未加载。发生这种情况是因为重写并且浏览器尝试从路径/panel/assets/...加载文件。使用绝对路径使事情有效。

<link href="/dashboard/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="/dashboard/assets/css/metro.css" rel="stylesheet" />
...