【发布时间】:2015-02-08 21:56:29
【问题描述】:
我有一个使用 URL 路由的 asp.net Web 表单网站 问题是当我尝试导航到匹配的路线时,例如“http://localhost:51878/brand/adidas”它不会打开指定的 aspx 文件它显示 HTTP 错误 404.0 - 未找到并导航到 D:\Websites\Website\brand\adidas
更新:我尝试在 global.asax.cs 文件中添加断点,显然它甚至没有通过 Application_Start 函数
这是我的 global.asax`
<%@ Application Language="C#" CodeBehind="Global.asax.cs" %>
这是我的 global.asax.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using System.Web.Security;
using System.Web.SessionState;
using System.Data;
using System.Data.SqlClient;
public partial class Global : HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
protected void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("brandsRoute", "brand/{brand}", "~/brand.aspx");
}
}
你能告诉我我做错了什么
【问题讨论】:
标签: asp.net webforms url-routing global-asax