How do I write SEO friendly Images file names using ASP.NET Web Forms and Routing
I would like improve SEO for my images on a website.
In my scenario:
I have my file for an image inside a folder:
mysite.com/cdn/cms/images/15554.jpg
(15554 represent the Imageid)I would like rewrite the
src
attribute for this file name so it would looks likemysite.com/cdn/cms/images/mypicturename-15554.jpg
How can I accomplish th开发者_StackOverflow社区is using only ASP.NET Routing features within .NET 4?
I would write a handler for the image resource. That way you can manage how you want to "virtually" name them however you want. Then when an outside request comes in whether they are actually using the site or trying to link to the image through a request you can map the virtual name to the name on the file structure (or in the database depending on your setup).
A Handler is definitely the way you want to go. Very low overhead.
精彩评论