title: Cannot access embedded resource in asp.net
body: <p>I'm trying to move an image and a style sheet from a user control to embedded resources in the assembly. I have used Reflector to see that the image and .css file are embedded in the assembly, but when I try to access them using the URL created by ClientScript.GetWebResourceUrl(), the resource is not found. I'm stumped.</p>
  
  <p>Assembly default namespace:</p>
  
  <pre><code>TestWebApp
  </code></pre>
  
  <p>The paths to the files (marked as BuildAction: Embedded Resource) are</p>
  
  <pre><code>TestWebApp/Resources/CSS/PaymentHistory.css
  TestWebApp/Resources/Images/loading.gif
  </code></pre>
  
  <p>And so my resources are registered as:</p>
  
  <pre><code>[assembly: WebResource("TestWebApp.Resources.CSS.PaymentHistory.css", "text/css", PerformSubstitution = true)]
  [assembly: WebResource("TestWebApp.Resources.Images.loading.gif", "image/gif")]
  </code></pre>
  
  <p>User Control (in the same assembly) that accesses the resources :</p>
  
  <pre><code>TestWebApp.UserControls.PaymentHistory
  </code></pre>
  
  <p>To simplify, I'm currently just trying to reference the image and not the stylesheet. In my user control's Page_Load, I set the ImageUrl of an Image control to the resource URL:</p>
  
  <pre><code>image1.ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "TestWebApp.Resources.Images.loading.gif");
  </code></pre>
  
  <p>At runtime, everything appears to work without errors but it renders a broken image. Here is the rendered image source:</p>
  
  <pre><code>&lt;img style="border-width:0px;" src="/WebResource.axd?d=8fC_1tLPjrUCxmFc_Q2MKY0-pHAak-sTWkpLLV3D56H_c08LujXC63ia2PNICE65_i-Q4JqprAigLpbrXG-rIAr6ePO4HHcdQKgdd3szlThv2gizxOJLJsPRNe-b_M6ApTwPsH_5oZAuONTN0cumOTRr1nA1&amp;amp;t=635133745137507721" id="ph1_image1"&gt;
  </code></pre>
  
  <p>If I navigate to that URL in my browser, I get a 404, The resource cannot be found. What am I doing wrong?</p>
  
  <p><strong>EDIT:</strong>
  There must be something fundamental I'm not understanding and/or I'm doing something really stupid. <a href="https://skydrive.live.com/redir?resid=F0FFD36CE2E82271!193&amp;authkey=!AMU6yyGevFUJ-Bc" rel="noreferrer"><strong>Here is a simple VS 2010 example</strong></a>. I have followed all of the required steps I'm aware of to embed JScript1.js and access it via WebResource.axd, but it gets the error.</p>