I've build a custom control and want to add an embedded js file to it. I think I did everything right and the controls compiles like expected.
I've marked the js file to Build Action "Embedded Resource"
The simplified control:
[assembly: WebResource("GoogleMapsLegend.js", "application/javascript", PerformSubstitution = true)]
namespace CustomControls
{
public class GoogleMapsLegend : WebControl
{
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.Page.ClientScript.RegisterClientScriptInclude(typeof(CustomControls.GoogleMapsLegend), "GoogleMapsLegend", Page.ClientScript.GetWebResourceUrl(typeof(CustomControls.GoogleMapsLegend), "GoogleMapsLegend.js"));
}
}
}
When I run the control in a DotNetNuke environment I get a 404
Failed to load resource: the server responded with a status of 404 (Not Found) http://testenvironment.dev.nl/WebResource.axd?d=9ubkUMGTBWycKhgQIG5UHmzbPQjp5hcuPdO…jQr5YlIXdwqph6fJIVdtyKxWHJnyuIP44D9akltG8kiDFVFdwSND0&t=635122452802549563
Are there additional setting I need to put in the web.config?
I've tried adding the following to the web.config, but no luck so far.
<add verb="*" path="WebResource.axd" validate="true" type="System.Web.Handlers.AssemblyResourceLoader" />
Is it possible there's a conflict with the Telerik.Web.UI.WebResource.axd?
I am not sure but it looks like the line you are using to register the script may be wrong. If I am correct where you have "GoogleMapsLegend.js" you need the namespace/path before it
So if the file is in a subdirectory like 'JavaScript' then I think that should read
"Namespace.Javascript.GoogleMapsLegend.js"
I may be wrong here but I have used this article in the past for this: http://weblogs.asp.net/briandukes/archive/2009/06/08/embedding-javascript-and-other-resources-in-a-net-assembly.aspx