2011-08-04 13 views
1

オプションのregex節(\ .ashx)で問題が発生していますか? ASP.NET MVCのルートMVCルートのオプション正規表現グループ?

routes.IgnoreRoute("resizer\\.debug(\\.ashx)?"); 
routes.IgnoreRoute("[^?]+\\.(psd|bmp|gif|exif|png|tif|tiff|tff|jpg|jpeg|jpe|jif|jfif|jfi)(\\.ashx)?"); 

に私は

The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character. 
Parameter name: routeUrl 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character. 
Parameter name: routeUrl 

[ArgumentException: The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character. 
Parameter name: routeUrl] 
    System.Web.Routing.RouteParser.Parse(String routeUrl) +21953 
    System.Web.Routing.Route.set_Url(String value) +12 
    System.Web.Routing.Route..ctor(String url, IRouteHandler routeHandler) +9 
    System.Web.Mvc.RouteCollectionExtensions.IgnoreRoute(RouteCollection routes, String url, Object constraints) +106 
    System.Web.Mvc.RouteCollectionExtensions.IgnoreRoute(RouteCollection routes, String url) +6 
    MvcApplication2.MvcApplication.RegisterRoutes(RouteCollection routes) in C:\Users\Administrator\Documents\resizer\Tests\Hidden\MvcApplication2\Global.asax.cs:15 
    MvcApplication2.MvcApplication.Application_Start() in C:\Users\Administrator\Documents\resizer\Tests\Hidden\MvcApplication2\Global.asax.cs:29 

がどのようにMVCのルートで、オプションの正規表現のグループをしますかエラーが出ますか?

答えて

1
+1

おかげで...私はその記事を見ました。私は.NET 2アセンブリからのリフレクションを介してそれを行うことができることを期待していましたが、基本クラスはそれを強制終了します...同様に、私は独自のStopRoutingRouteを定義しましたが、それを行うアセンブリ。 –