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 4096182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:00:47+00:00 2026-05-20T20:00:47+00:00

I have a following setup. I have a web application and in the .css

  • 0

I have a following setup. I have a web application and in the .css of this application I define a background image to be presented when I hover over some element.

I want a script or something of that sort that sits on the server and when the image is accessed, it calls an action on the application. Unfortunately, I have no idea where to begin.

I want to know if and some hints on how to write a server side component that executes an action in web application based on the request for a file by css.

I am on Windows7, ASP.NET MVC.

EDIT

So, I have followed your suggestions on using httpHandlers. It seems like the perfect solution. However, I am running into problems.

I have followed this very helpful link http://www.phpvs.net/2009/08/06/aspnet-mvc-how-to-route-to-images-or-other-file-types/ but I was just unable to get a hit on a route

routes.Add("ImageRouting", new Route("Content/themes/base/images/{filename}.png", new ImageRouteHandler()));

My only other route is the one generated by default by MVC template.

So I figured out that the requests to a file are not handled by default by MVC. So I had to fix that by by setting the RouteExistingFiles property of the RouteCollection to true.

Now I get proper hits on my images but for some reason, Site.css located in Content folder is not used to style the resulting html.

Any suggestions?

  • 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-05-20T20:00:48+00:00Added an answer on May 20, 2026 at 8:00 pm

    Add an HttpHandler in your machine.config or web.config like so:

    <httpHandlers>
        <add verb="supported http verbs" path="path" type="namespace.classname, assemblyname" />
    <httpHandlers>
    

    Your verb can be “*” or “GET”, set path equal to the location of your image file on the server, and fill the type variables according to your namespace, class and handler function.

    For a more detailed explanation, see:
    http://www.15seconds.com/issue/020417.htm

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

Sidebar

Related Questions

I have a web application running on Windows IIS. This app has a database
I have a web application deployment project setup for an ASP.NET application with Visual
Given the following setup, I have three assemblies. Web (ASP.NET MVC 3.0 RC1) Models
I have the following setup: Code on my local machine (OS X) shared as
How do you setup a multi-developer XDebug PHP environment? I have the following setup:
I have following string String str = replace :) :) with some other string;
I have a Java web application that currently uses Log4J for logging. I'd like
My current setup : I have an entity object with some properties, among them
I have the following unit test in my application: [TestMethod] public void Windsor_Can_Resolve_HomeController_Dependencies() {
I have following situation: I have loged user, standard authentication with DB table $authAdapter

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.