简体   繁体   中英

URL Routing doesn't work when I don't include a parameter

So am trying to do some Routing and I seem to have an issue when I don't include any parameters. I am not sure if this is because I am linking from the master page or what.

Here is what is in my Global.asax App_Start Method

routes.MapPageRoute("Ninja", "SalesRep", "~/SalesRep/SalesRepHome.aspx");

My link from my master page is

<asp:HyperLink ID="hlFashion" runat="server" CssClass="navSubFont" Width="100%"    NavigateUrl="~/SalesRep" Text="Test">

When I run it like this, it just gives the 403.14 directory not found error. However if I add a parameter on it seems to work fine

<asp:HyperLink ID="hlFashion" runat="server" CssClass="navSubFont" Width="100%"    NavigateUrl="~/SalesRep/TestParam" Text="Test">

Does anyone know why it wouldn't work without a parameter?

所以问题是,目录与路由URL的名称相同,所以我将路由URL重命名为Rep,并且工作正常。

routes.MapPageRoute("Ninja", "Rep", "~/SalesRep/SalesRepHome.aspx");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM