0
我为我的网站新闻部分有一个简单的路由。路由工作正常,几乎所有的URL像ASP.net 4.0路由不能与主要域名一起工作
http://www.abc.com/Default.aspx
http://www.abc.com/Default.aspx?PageId=3
http://www.abc.com/Latest-News-Details.aspx?PageID=28&NewsID=39
问题只当我尝试用http://www.abc.com访问网站的一些情况原因它重定向到自定义错误页面,我不能跟踪错误来源&我不能在我的本地主机上产生任何这样的错误。
代码示例
global.asx文件
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RegisterRoutes(RouteTable.Routes);
//RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.Ignore("{*allaspx}", new { allaspx = @".*\.aspx(/.*)?" });
routes.Ignore("{*allcss}", new { allcss = @".*\.css(/.*)?" });
routes.Ignore("{*alljpg}", new { alljpg = @".*\.jpg(/.*)?" });
routes.Ignore("{*alljs}", new { alljs = @".*\.js(/.*)?" });
routes.Add(new System.Web.Routing.Route("{resource}.css/{*pathInfo}", new System.Web.Routing.StopRoutingHandler()));
routes.Add(new System.Web.Routing.Route("{resource}.js/{*pathInfo}", new System.Web.Routing.StopRoutingHandler()));
////For News
routes.MapPageRoute("NewsRoute", "{NewsID}/{PageID}/{NewsTitle}", "~/Latest-News-Details.aspx", false,
new RouteValueDictionary {
{ "NewsID", "0" },
{ "PageID", "0"},
{ "NewsTitle", "event-not-found" }},
new RouteValueDictionary {
{ "NewsID", "[0-9]{1,8}" },
{ "PageID", "[0-9]{1,8}" }
});
}
现在我有禁用路由的新闻栏目,如果我离开上述航线代码取消注释它仍然产生错误。
我不确定是什么导致了这个问题。
我怎么能处理根像http://www.abc.com
默认域我希望帮助这对于
你hav在IIS中设置默认文档? – pkmiec
它工作,如果路由被禁用,我认为问题是与路径 – Learning