c# - Load picture from a .NET assembly resource in a simple HTML file? -


i have .net server control app returns html. need embed several picture files assembly html file can use them src= each of them.

we have .html file lives in project embedded resource , server control code read html , serve up. within html, need have picture src links (as css, js, etc) point embedded resource files.

does know code put in html file pictures make point embedded picture file?

i have on grand scale... hundreds of times. programmatic approach doing can write wrapper , never have touch again when update server control new html, picture files, etc.

one might imagine way @ compile time can loop through embedded files getmanifestresourcenames , replace() src links http resource links suppose?

thank guidance!

hm, question covers quite many aspects. let me repeat see if got it: have assembly, raw html file in it. file references items, found within same assembly, , want have them served client upon request well.

one possible solution might this.

  • instead of raw html file, use templated one. then, feed available resource names proper url's templating engine, replace placeholders.you may want @ dotliquid this.
  • create http handler each file type want serve. inside handler, pull item resources of dll , serve them.

alternatively, if resources rather small, want have data uri scheme, save requests , omit handler. replace placeholders data uri's directly, , serve single html file in in frist place.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -