开发者

URL routing process works on one web, not another. 100% processor usage

I thought I have URL routing under control as it works well on one website but found out it is not working fine on another. Both websites run from same server, same IIS 6.0, same asp_isapi.dll.

SETUP 1: This one works well:

            routes.MapPageRoute("Article SEO",
                        "sid/{sid}",
                        "~/ar.aspx",
                        true,
                        new RouteValueDictionary { },
                        new RouteValueDictionary { { "sid", @"^([a-zA-Z\-]*)+([a-zA-Z])+(.html)$" } }

                    );

SETUP 2: But this one, very similar is not working well:

        routes.MapPageRoute("Article",
                        "page/{sid}",
                        "~/page.aspx",
                        true,
                        new RouteValueDictionary { },
                        new RouteValueDictionary { { "sid", @"^([a-zA-Z0-9\-]*)+([a-zA-Z0-9])+(.html)$" } }
                    );

Testing Regex in the Regex Coach shows that they are written correctly, I mean they both catch good or wrong strings.

URL I use for the second one is http://address/page/some-html-keywords.html. If I specify URL like this it works well.

Problem is if I change .html extension for something like .htmls or .anything it completely kills web server. I have 100% process usage. I dont understand why and how, I dont have this problem with first setup. I can change it for whatever I want and it either shows page 开发者_开发知识库because I have correct format or shows 404 page not found.

Some examples:

http://address/page - 404 page, working correctly

http://address/page/test.html - accepted, working correctly

http://address/page/testing_#.html - 404 page, working correctly

http://address/page/test.htmls - wont show page, hanging, 100% process usage, not working correctly

http://address/page/test.whatever - wont show page, hanging, 100% process usage, not working correctly

http://address/page/page.aspx - redirects, working correctly

The same setup (with different Regex check) works well on other website within same IIS 6.0. Both use same asp_isapi.dll file.

I just dont get it. I have tried to comment all code in page.aspx to find out if there was problem with the code within page.aspx but it doesnt matter. It simply hangs with empty page as well. So must be problem with URL routing or isapi.dll or IIS. But other website on same IIS and same machine simply works.

Any opinions?

Thank you

Fero


I don't know anything about URL routing

BUT I notice that the regular expression you specify

@"^([a-zA-Z0-9\-]*)+([a-zA-Z0-9])+(.html)$"

Looks to be the same in both code samples AND (again, in both examples) ends with a trailing $ (which means end-of-string), which will prohibit anything NOT ending in .html from being matched by that regular expression. To get .htmls you need (.html.*)$, to get .anything you need something like

@"^([a-zA-Z0-9\-]*)+([a-zA-Z0-9])+\.[a-zA-Z0-9]*$"

Also, it probably would be a good idea to esacpe the '.' just before html, like \.html, as reg expressions normally process '.' to mean any single character, which includes the '.' character.

I Hope this helps.


Learn how to analyze ASP.NET high CPU root cause, and then you will find out why,

http://blogs.msdn.com/b/tess/archive/2008/02/22/net-debugging-demos-lab-4-high-cpu-hang.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜