2015-02-08 70 views
0

我有一個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"); 
     } 

    } 

將ü請告訴我,我做錯了什麼

回答

0

您發佈的代碼看起來不錯,除了錯誤>字符您using下語句,這可能會導致您的代碼無法構建,也許您正在運行最後一個不包含新路線的良好構建版本。