开发者

Embed js, css, images into separate assembly to read from asp.net web site

开发者 https://www.devze.com 2023-01-14 21:58 出处:网络
I\'d like to create a class library project where embed resources like js, css and maybe image files.

I'd like to create a class library project where embed resources like js, css and maybe image files. I would compile it and copy the dll into the bin fol开发者_JAVA技巧der of my web site to include the resources into my pages with GetWebResourceUrl.

I tried with an assembly that have no .cs files, but it doesn't seem to work, I can't see the namespace of the assembly in the web project.

Is it possible doing this? Someone could provide a small tutorial?

Thanks


the best way to embed the files like js , css and ... to dll is to select the embedded resources in build action of file property. take a look at this:

http://hasantechno.blogspot.com/2011/04/aspnet-embedding-resources-image-css.html

by the way if you want to forbid any kind of unknown requests(out of you web site) to navigate the contents.


If you want to reduce the loading time, serve the media files as static content, as example over nginx.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号