0
我有一個路由配置文件,我試圖路由遵循公式.com/{a page}/{子頁面}的所有URL,以路由到特定頁面.com /默認/ Page.aspx。我的問題是,它爲所有頁面(即,.com/Account/Login.aspx)都這樣做。是否有一種方法可以指定我希望它只有在用戶將其輸入地址欄時才能發送到該頁面?只有當他們離開了.aspx擴展這是我到目前爲止有:ASP.NET路由所有頁面
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.Membership.OpenAuth;
using System.Web.Routing;
using Microsoft.AspNet.FriendlyUrls;
namespace CouponsForGiving
{
public static class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.Ignore("{resource}.axd/{*pathInfo}");
routes.MapPageRoute("LearnMore", "LearnMore", "~/LearnMore.aspx");
routes.MapPageRoute("DefaultPage", "{nponame}", "~/Default/NPOPage.aspx");
routes.MapPageRoute("CampaignPage", "{nponame}/{campaignname}", "~/Default/CampaignPage.aspx"); //This one routes a lot of other pages
routes.EnableFriendlyUrls();
}
}
}
感謝這裏
好了,但我的問題是,當我點擊我的網站的鏈接,比如一個登錄真實重定向。 – Jack
老兄,你能不能請精心處理你的問題?我在上述評論中沒有得到你的觀點。 –