ASP.Net MVC 3访问CSS,从单独的DLL JS文件 [英] ASP.Net MVC 3 accessing CSS, JS files from separate DLL

查看:329
本文介绍了ASP.Net MVC 3访问CSS,从单独的DLL JS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下面这个链接,的编译剃刀文件到单独的DLL ,并能得到它的工作只是我无法弄清楚如何访问嵌入JavaScript的DLL,CSS和图像。

I'm following this link, compile razor files into separate dll, and can get it to work except I can't figure out how to access JavaScript, CSS, and Images embedded in the dll.

有没有人用这种方法?这似乎非常有前途的。谢谢你。

Has anyone used this approach? It seems very promising. Thanks.

推荐答案

在这篇文章中psented该技术$ P $是嵌入剃须刀意见纳入单独的组件。它不会让你有静态资源,如图片,JS和CSS这样做。对于那些类型的资源,你将必须实现一个定制的解决方案。例如,你可以写一个给定的资源名称的控制器,可以从组件(的 GetManifestResourceStream )并写入流的响应。然后,你可以简单地生成您的看法链接到本控制器操作( Url.Action ),并通过资源名。

The technique presented in this article is for embedding razor views into separate assemblies. It doesn't allow you to do so with static resources such as images, js and CSS. For those type of resources you will have to implement a custom solution. For example you could write a controller which, given a resource name, could read it from the assembly (GetManifestResourceStream) and write the stream to the response. Then you could simply generate links to this controller action in your views (Url.Action) and pass the resource name.

这篇关于ASP.Net MVC 3访问CSS,从单独的DLL JS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆