F
Frédéric Mayot
Hi,
I'm trying to embed a js file in my class library and register it in an
aspx.
I created the most simple solution I could :
+ ClassLibrary1 :
- Class1.cs
- test.js (embedded resource)
+WebSite
- Default.aspx
The page is displayed correctly with the resource url :
/WebSite2/WebResource.axd?d=xnJEzCL_Wi5ffEYd13hU2ywYJr-rFccyB13UatbX-2Q1&t=632713812869876368
When I copy/paste this link in my browser, I get a blank page. This
mechanism works for the .NET framework and not for my projet, that's weird.
I'm using VS Team Suite : 8.0.50727.42 (RTM.050727-4200)
..NET Frameword 2.0.50727
Could it be a question of authorization?
Thanks,
Fred
--------------------------------------
Content of class1.cs
[assembly: System.Web.UI.WebResource("test.js", "application/x-javascript")]
namespace ClassLibrary1
{
public class Class1 : WebControl
{
protected override void CreateChildControls()
{
base.CreateChildControls();
Literal l = new Literal();
l.Text = Page.ClientScript.GetWebResourceUrl(this.GetType(),
"test.js");
Controls.Add(l);
}
}
}
I'm trying to embed a js file in my class library and register it in an
aspx.
I created the most simple solution I could :
+ ClassLibrary1 :
- Class1.cs
- test.js (embedded resource)
+WebSite
- Default.aspx
The page is displayed correctly with the resource url :
/WebSite2/WebResource.axd?d=xnJEzCL_Wi5ffEYd13hU2ywYJr-rFccyB13UatbX-2Q1&t=632713812869876368
When I copy/paste this link in my browser, I get a blank page. This
mechanism works for the .NET framework and not for my projet, that's weird.
I'm using VS Team Suite : 8.0.50727.42 (RTM.050727-4200)
..NET Frameword 2.0.50727
Could it be a question of authorization?
Thanks,
Fred
--------------------------------------
Content of class1.cs
[assembly: System.Web.UI.WebResource("test.js", "application/x-javascript")]
namespace ClassLibrary1
{
public class Class1 : WebControl
{
protected override void CreateChildControls()
{
base.CreateChildControls();
Literal l = new Literal();
l.Text = Page.ClientScript.GetWebResourceUrl(this.GetType(),
"test.js");
Controls.Add(l);
}
}
}