0

I have a common assembly where I put a lot of my helper functions etc. I want to create a common EmbeddedResourceController (kind of like WebResource.axd was for WebForms) which all my HTML helpers can use to embed and display their scripts and styles. The problem is, I need to be able to create an include path from my HTML helper code in a project agnostic way (ie without knowing any of the routing/controller rules in that project).

Ideally, I want to create an include like <script type="text/javascript" src="/EmbeddedResource/myJsScript.js"></script> from the helper code and have it work in every project that uses my common dll.

just.another.programmer
  • 8,579
  • 8
  • 51
  • 90

2 Answers2

0

If I understand your question correctly, you can just use this EmbeddedResource controller as a base for a controller in each of your projects:

EmbeddedResourceController : EmbeddedResourceBase

Where EmbeddedResourceBase lives in your common dll

Maess
  • 4,118
  • 20
  • 29
0

Perhaps you can use an HTML helper extension. Take a look at Mr Bell's answer in the following question Populate a Razor Section From a Partial

Community
  • 1
  • 1
melutovich
  • 372
  • 1
  • 3
  • 15