asp.net网页表单URL路由不映射到物理文件

问题描述:

我有一个asp.net网页形式的网站,我使用URL路由 事情是当我尝试ti导航到匹配的路线,例如“http://localhost:51878/brand/adidas “它不打开指定的aspx文件它显示HTTP错误404.0 - 未找到并导航到D:\网站\网站\品牌\阿迪达斯asp.net网页表单URL路由不映射到物理文件

更新:我试着添加断点到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"); 
     } 

    } 

将ü请告诉我,我做错了什么

您发布的代码看起来不错,除了错误>字符您using下语句,这可能会导致您的代码无法构建,也许您正在运行最后一个不包含新路线的良好构建版本。