How do I route images through ASP.NET routing?

后端 未结 5 1257
一生所求
一生所求 2021-02-09 07:31

I\'d like to create a dynamic thumbnail resizer so that you can use the following URL to get a resized image:

http://server/images/image.jpg?width=320&height         


        
5条回答
  •  感情败类
    2021-02-09 07:59

    Thats how asp.net routing works, there is no away around that... you have to use Rewrite if you want to intercept requests for existing files.

    Update

    Seems like i was a bit too fast on the trigger there. There seems to be a property you can set which allows you to enforce a route even for existing files.

    RouteCollection.RouteExistingFiles Property

    http://msdn.microsoft.com/en-us/library/system.web.routing.routecollection.routeexistingfiles.aspx

    Gets or sets a value that indicates whether ASP.NET routing should handle URLs that match an existing file. True if ASP.NET routing handles all requests, even those that match an existing file; otherwise, false. The default value is false.

提交回复
热议问题