Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8293021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:41:16+00:00 2026-06-08T13:41:16+00:00

I have setup a routing table in the global.asax file for images that have

  • 0

I have setup a routing table in the global.asax file for images that have been moved to the database. When I use the url such that EmpImages/[numeric id] as a basic format, it works fine if I use the url that does that same ~/EmpImages/42, but we have hundreds of hardcoded links that are ~/EmpImages/42.png. When I try to use the EmpImages/[numeric id].png, the handler is never called.

I have looked at several samples that show the .ext, but they are using page routes instead of handlers. With the code below, can you tell me what I’m missing?

This part works:

RouteTable.Routes.Add(new Route("EmpImages/{id}/{size}", new EmployeeImageRouteHandler()));
RouteTable.Routes.Add(new Route("EmpImages/{id}", new EmployeeImageRouteHandler()));

When using the URL:

~/EmpImages/42
~/EmpImages/42/256

But when I try:

RouteTable.Routes.Add(new Route("EmpImages/{id}/{size}.png", new EmployeeImageRouteHandler()));
RouteTable.Routes.Add(new Route("EmpImages/{id}.png", new EmployeeImageRouteHandler()));

When using the URL:

~/EmpImages/42.png
~/EmpImages/42/256.png

It fails. The handler is never called.

What simple thing am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T13:41:17+00:00Added an answer on June 8, 2026 at 1:41 pm

    According to the documentation for Route, it seems that the way you are specifying the route is unsupported.

    Quoting the docs:

    The URL pattern consists of segments that come after the application name in an HTTP request… Each segment is delimited by the / character. When a segment is enclosed in braces ( { and } ), the segment is referred to a URL parameter. ASP.NET routing retrieves the value from the request and assigns it to the URL parameter… If the segment is not enclosed in braces, the value is treated as a literal value.

    Apparently, it does not support segments with mixed URL parameters and literals.

    You need to have your EmployeeImageRouteHandler internally deal with the “.png” extension of the size parameter with string processing.

    EDIT: In addition to this point, it seems that there is a known problem in handling URLs with dots see this StackOverflow question . The solution proposed there is to include

    <httpRuntime relaxedUrlToFileSystemMapping="true" />
    

    in your web.config, but this works only for ASP 4.0 and IIS 7.0 and above. The details of this problem, as mentioned in the indicated question, are discussed on Haacked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my global.asax I have url routing setup like below: routes.MapPageRoute(User Logon, {Vendor}/Logon, ~/Logon.aspx);
I have a CI application that uses .htaccess for URL routing. My basic setup
I have setup url routing in my ASP.NET 4 project, which works perfectly offline.
I have 24/7 service which keeps setup (configuration data) for charging, routing and etc
I have this routing setup at the moment routes.MapRoute( OldPages, // Route name page{id}.html,
I have successfully setup routing in Asp.Net 4.0 webforms. I have set up: routeCollection.MapPageRoute(Default
I am trying to setup routing based on the 1st URI segment. I have
Let's say I have a Magazine model and Ad model, such that Magazine :has_many
I have faced some problem trying to setup angular routing. I have an application
I have an Spring+Hibernate/Flex application that needs to switch dynamically between database schemas. To

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.