Troubleshooting Issue: Incompatibility with CSS Webresources in Custom ASP Control Library

In my latest project, I created a Custom Control DLL that extends existing Telerik and ASP controls. As part of this process, I also introduced new CSS classes that utilize images. However, I encountered an issue where these images were not being loaded in the main project.

Project Information:
Microsoft .NET Framework Version: 4.0.30319
ASP.NET Version: 4.8.4001.0
Telerik UI for Ajax 2014Q1
ASP Webforms

Steps Taken:
1. Included the necessary files (css and images) in the AssemblyInfo
2. Set PerformSubstitution = true for the css file
3. Set the Build Action for the images and the css file to Embedded Resource
4. Replaced the image paths in the css file with WebResource paths
5. Compiled the Library and placed it into my library directory within the main project
6. Added the controls in the web.config

Snippet from AssemblyInfo.cs

//Css 
[assembly: WebResource("css.myCss.css", "text/css", PerformSubstitution = true)]

//Css related pictures
[assembly: WebResource("css.images.myImage.png", "image/png")]

Content of myCss.css

.myCssClass{
        background-image: url('<%=WebResource("myProject.css.images.myImage.png")%>');
}

Content of web.config

<configuration>
  <system.web>
    <pages>
      <controls>
        <add tagPrefix="myControls" assembly="myProject" namespace="myProject" />
        ... 
      </controls>
    </pages>
  </system.web>
</configuration>

I am experiencing issues with the WebResource.axd http requests for my control returning a 404 error. The telerik requests are functioning normally. Can anyone advise on how to resolve this issue and make those images work properly?

Thank you in advance, Lifree

Answer №1

After some troubleshooting... I realized that myProject needed to be included in the AssemblyInfo:

//CSS styles
[assembly: WebResource("myProject.styles.myStyles.css", "text/css", PerformSubstitution = true)]

//Images for CSS
[assembly: WebResource("myProject.styles.images.myImage.png", "image/png")]

Although I had this set up previously, it was omitted from a tutorial I came across. Along with a couple of other minor oversights, it slipped my mind until now.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Use jQuery to smoothly scroll a div

I created a container using a <div> element which is divided into 3 inner divs. The first two inner divs are meant to serve as previous and next buttons, with ids of prev and next respectively. At the bottom, there are 3 more inner divs, each with un ...

What is the best way to showcase my background image using html and css?

I've come across a similar topic addressing my problem, but I am still unable to resolve it. I am attempting to add a background image to my portfolio, but for some reason, it is not working. Can anyone offer any suggestions or ideas? Here is the cod ...

Tips for adjusting large resolution images to fit all screen sizes without exceeding the boundaries of the screen

I am in the process of creating a set of HTML pages specifically tailored for iPad Air and iPad Mini. These pages will feature several large images, with dimensions such as 1600x300. However, upon testing in Windows browsers, I encountered an issue where t ...

When a single piece of content is exposed, it has the power to bring down all

I've been working with some code where clicking on a specific button toggles the visibility of certain contents. It's functionality is satisfactory, but I want to take it a step further. In addition to showing and hiding content, I also want to e ...

Struggling with your Dropdown Menu onclick functionality in Javascript? Let me lend

I am seeking assistance with implementing a Javascript onclick Dropdown Menu. The current issue I am facing is that when one menu is opened and another menu is clicked, the previous menu remains open. My desired solution is to have the previously open menu ...

Displaying a single div while concealing the remaining two divs upon pressing a button

There are 3 hidden DIVs on a webpage. Clicking on a heading should display one DIV while hiding the other 2. Below is the code I used to achieve this, but it doesn't work properly on all browsers like iPad and iPhone. Is there a more efficient way to ...

Engage in a sequence of actions by tapping and retapping on a div element

Is there a way to toggle the color of an element from black to orange with a single click and back again with another click? Additionally, I have set up a hover effect in CSS that changes the color to orange when hovered over. In my current code, the elem ...

Enhance User Experience with the Tooltip Feature and Customized

Here is the jQuery code I am using to style my tooltips: $(function() { // select all input fields within #tooltips and attach tooltips to them $("#tooltips :input").tooltip({ // place tooltip on the right edge position: "cen ...

Enable vertical overflow to adjust automatically without needing to set a specific height

I have a unique table that consists of 3 main parts: the header the content the footer Using flexbox, I managed to make the "content" section occupy all available view height. However, this was not explicitly done and now when there are too many items in ...

Using Symfony2 Knp-snappy library for PDF generation, the CSS styling is not being properly imported

Attempting to create a PDF from an html.twig template, but facing some issues... Although the content is correct in the PDF, the layout is missing. It appears that the CSS files are not being imported... Bootstrap from Twitter is being used to handle the ...

Is it possible to use personalized fonts alongside Google web fonts?

I'm looking to incorporate my customized font into a website using Google's font loader. Any recommendations on how to achieve this? ...

CSS - Button with upwards pointing arrow, requiring it to point downwards when hovered over

Struggling with the following issue: I have a button with a downward-pointing arrow in its description. When I hover over the button (or any content within it), I want the arrow to point upwards. However, currently, the arrow only points up when I hover ...

Switch the authentication mode from "Forms" to "Windows", ensuring you proceed to login.aspx

After switching the authentication mode from "Forms" to "Windows," my configuration now looks like this: <authentication mode="Windows"/> <identity impersonate="true"/> <authorization> <deny users="?"/> </autho ...

Inheriting Django templates for a unique CSS class markup approach

I want to create a master.html file for inheritance, but I'm facing an issue where the code is repetitive in three different places except for the body class. Here's my current master.html: <html> <head>...</head> <body& ...

The barely noticeable difference of 1 pixel in the link between Chrome and Firefox

Hello there, I need some advice on how to adjust a one-pixel difference between Chrome and Firefox. The menu links appear correctly in Chrome, but in Firefox, they are 1px smaller than they should be. Below is the CSS code: ul#menu { padding: 0 0 2px ...

Creating a customizable navigation bar using only CSS

I'm currently working on creating a navigation bar using only HTML and CSS, without the need for JavaScript to open and close it. However, I've encountered an issue where the navigation bar remains open even after setting display: none or visibi ...

The functionality of 'Access-Control-Allow-Origin': '*' is not operational

I attempted to address all inquiries pertaining to this tag, yet I encountered a hurdle. Where did I go wrong? $(document).ready(function () { $.ajax({ type: "GET", url: "http://www.tcmb.gov.tr/kurlar/today.xml", dataType: "xml ...

Styling spellcheck errors in Chrome with CSS or JavaScript

One issue I am facing is the need to change the language of a spelling error on a website without disabling it: I have attempted various solutions, but none of the properties like ::spelling-error and :webkit-spell-check seem to be supported. Is there a ...

Crystal Reports does not recognize or integrate HTML elements

Despite entering HTML text on the field: https://i.sstatic.net/vyvQ2.png Even though I am using valid tags as explained in this resource: What HTML tags are supported in Crystal Reports 2008, my report is not generating HTML but only displaying the tags ...

Align Bootstrap 4 dropdowns with their parent element

Is there a way to match the width of a bootstrap dropdown menu with its parent input group? <div id="ddl_1" class="input-group"> <input type="text" class="form-control "> <div class="input ...