我有这样的文件夹结构:
I have a folder structure like this:
www.mysite/About/About.aspx我在用户控件中有这样的链接:
I have a link in a user control like this:
<a href="~/About/About" id="aboutLink" title="About" runat="server">About</a>在我的RegisterRoutes()方法中,我有以下内容:
And in my RegisterRoutes() method, I have this:
routes.MapPageRoute("", "About/About/", "~/About/About.aspx");它可以工作,但是会产生以下URL:
It works but produces the following URL:
www.mysite/About/About什么我想这样:
www.mysite/About开箱即用的4.0路由是否可能?
Is this possible with out-of-the-box 4.0 routing?
更新2 -2010年5月14日: 显然,我引入了一个额外的问题,将.aspx Web窗体命名为与包含文件夹相同。最后,这对我有用:
UPDATE 2 - 05-14-2010: Apparently, I introduced an extra issue by naming the .aspx Web Form the same as the containing folder. Finally, this is what worked for me:
RouteTable.Routes.MapPageRoute("", "About/", "~/AboutUs/About.aspx"); <asp:HyperLink ID="aboutLink" NavigateUrl="~/About" Text="About" runat="server"></asp:HyperLink>Raj提供的链接帮助我找到了答案:-) msdn.microsoft/en-us/library/cc668201。 aspx
The links provided by Raj helped me find the answer :-) msdn.microsoft/en-us/library/cc668201.aspx
推荐答案我不清楚您的问题。 试试这个
Your question is not clear to me. Try this
routes.MapPageRoute("", "About/", "~/About/About.aspx");另外,考虑使用RouteURl表达式。
Also, consider using RouteURl expressions.
msdn.microsoft/en-us/library/dd329551 .aspx
msdn.microsoft/en-us/library/cc668176.aspx
更多推荐
ASP.NET 4.0路由和子文件夹
发布评论