I'm practicing to use embedded resource in ASP.Net. I wrote a javascript file, put it into a C# class library and change It's Build Action Property to Embedded Resource. In my web project, I added reference to the that class library. I want to use that javascript file in my web pages but i don't know how? please help me
Thanks
My problem was resolved. Anybody can accomplish as following steps: - Add a class library to your solution - Add the resource files which you want to embed - Register your resource in AssemblyInfo.cs
[assembly: System.Web.UI.WebResource("A.B.C", "D")]
with: A is your class library name B is the folder's name which contain your resource file C is the resource files'name D is the content type of your resource ("text/javascript" or another)
string scriptLocation = Page.ClientScript.GetWebResourceUrl(typeof(the empty class' name which added before), "A.B.C"); Page.ClientScript.RegisterClientScriptInclude("A.B.C", scriptLocation);