W*n
2 楼
最近遇到一个有意思的问题:如何让razor view engine可以渲染.htm 或者.html的文
件。razor有一个强制的文件后缀检查,要求文件必须是.cshtml,.vbhtml,aspx。今天
用了一个很怪的workaround搞定了。。就是弄了一个virtual path provider,当razor
请求特定virtual目录下的文件时,让razor以为在访问.cshtml,现在work的还不错,
但是感觉很怪很怪。。不知道有没有别的方法来解决?
stackoverflow上说可以添加buildprovider,但我怎么试也不好用。
件。razor有一个强制的文件后缀检查,要求文件必须是.cshtml,.vbhtml,aspx。今天
用了一个很怪的workaround搞定了。。就是弄了一个virtual path provider,当razor
请求特定virtual目录下的文件时,让razor以为在访问.cshtml,现在work的还不错,
但是感觉很怪很怪。。不知道有没有别的方法来解决?
stackoverflow上说可以添加buildprovider,但我怎么试也不好用。
c*o
3 楼
i remember easytune played lots of such songs.
i dont really like most of them in fact...
which ones do u like?
i dont really like most of them in fact...
which ones do u like?
k*n
4 楼
为什么要这样?
你明明不是纯html格式啊。
你明明不是纯html格式啊。
s*o
6 楼
not sure why you want .html files, which contain static content, to go
through view engine. If you just want to keep cleaner URL, using something
like Response.WriteFile, Server.Transfer, etc in an action method may be an
easier hack.
through view engine. If you just want to keep cleaner URL, using something
like Response.WriteFile, Server.Transfer, etc in an action method may be an
easier hack.
W*n
8 楼
既然mvc里请求动态内容全是controller来处理,没有传统页面的概念,那razor又何须
检查文件后缀呢?如果只是为了intellisense,可以通过别的方式实现吧。。例如那个
views目录下的web.config。
这样的话,razor完全可以变成一个更通用的template engine。
an
【在 s***o 的大作中提到】
: not sure why you want .html files, which contain static content, to go
: through view engine. If you just want to keep cleaner URL, using something
: like Response.WriteFile, Server.Transfer, etc in an action method may be an
: easier hack.
检查文件后缀呢?如果只是为了intellisense,可以通过别的方式实现吧。。例如那个
views目录下的web.config。
这样的话,razor完全可以变成一个更通用的template engine。
an
【在 s***o 的大作中提到】
: not sure why you want .html files, which contain static content, to go
: through view engine. If you just want to keep cleaner URL, using something
: like Response.WriteFile, Server.Transfer, etc in an action method may be an
: easier hack.
s*o
10 楼
Multiple view engines can co-exist. File extensions are used to determine
which view engine to pick up - Razor for .cshtml, WebForms for .aspx, Spark
for .spark, etc.
For .html files, IIS is supposed to deliver its content directly. But in
your case, I guess there are some Razor specific syntax in those .html files
, such as @RenderBody...One idea is to write and register your own view
engine. Ideally you can extend Razor by just overriding whatever are related
.
If I remember correctly, Steve Sanderson has a sample in his MVC book for
handling .xml files.
【在 W********n 的大作中提到】
: 既然mvc里请求动态内容全是controller来处理,没有传统页面的概念,那razor又何须
: 检查文件后缀呢?如果只是为了intellisense,可以通过别的方式实现吧。。例如那个
: views目录下的web.config。
: 这样的话,razor完全可以变成一个更通用的template engine。
:
: an
which view engine to pick up - Razor for .cshtml, WebForms for .aspx, Spark
for .spark, etc.
For .html files, IIS is supposed to deliver its content directly. But in
your case, I guess there are some Razor specific syntax in those .html files
, such as @RenderBody...One idea is to write and register your own view
engine. Ideally you can extend Razor by just overriding whatever are related
.
If I remember correctly, Steve Sanderson has a sample in his MVC book for
handling .xml files.
【在 W********n 的大作中提到】
: 既然mvc里请求动态内容全是controller来处理,没有传统页面的概念,那razor又何须
: 检查文件后缀呢?如果只是为了intellisense,可以通过别的方式实现吧。。例如那个
: views目录下的web.config。
: 这样的话,razor完全可以变成一个更通用的template engine。
:
: an
k*n
11 楼
以前mvc2时,webform与mvc混用的话,aspx必须放在content里,与纯html与css等在一
起。。mvc3还不知道咋处理的。
起。。mvc3还不知道咋处理的。
相关阅读
关于Universal Application Platformmvc4到底比web form application好在哪里?.Net job opening问一个关于第三方软件包dll的LICENSE问题大家是用azure还是ec2Deployment and auto-updateVS 2017里,右键菜单里没有了BREAK POINT?mvc还是mvp ,哪个好?大家把一个solution分成几个部分吗,web app, business logic layer,xxx layer...SharePoint当数据库服务器用用telerik还是angularjs + bootstrap做网页? (转载)请推荐testing软件回国低价转让!吉他、山地车、打印机、电钢琴、电饭煲等生活用品windows 10和vs 2015的问题求网络项目 (转载)DataTable.NewRow的primary key初始为0的问题.net position in Houston FYIc#l developer positionaccess database问题Directory.GetFiles() is not working on client computer