Hi I am having trouble getting an embedded js file to work.
I have tried all of the following:
- Running Cassini development server (VS2008, .NET 3.5)
- Added [assembly: WebResource("MyNamespace.MyScriptFile.js", "text/javascript")] above the class's namespace declaration.
- Script file has build action "Embedded Resource".
- Tried registering during OnInit, OnLoad and OnPreRender
- Script file is in the same assembly and namespace as the control registering it.
- Opened assembly with Reflector and verified the name of the resource is correct.
Does not work using any of the following methods:
ScriptManager.RegisterClientScriptResource(Page, GetType(), "MyNamespace.MyScriptFile.js"); Page.ClientScript.RegisterClientScriptResource(GetType(), "MyNamespace.MyScriptFile.js"); Page.ClientScript.RegisterClientScriptInclude(GetType(), "key", Page.ClientScript.GetWebResourceUrl(GetType(), "MyNamespace.MyScriptFile.js"));
- Other WebResource.axd files are being found - only this one is not being found.
The request for the resource returns a 404 page with an exception listed: "*[HttpException]: This is an invalid webresource request.*"
Using the ScriptManager.RegisterClientScriptResource produces the exception:
"*Web resource 'MyNamespace.MyScriptFile.js' was not found.*"