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还不知道咋处理的。
相关阅读
求Bakoma Tex registration code数据绑定问题VB.Net 问题:Form 自动消失免费的书来了。mono问题请教c# smtpclient's atthenicationhow to conver 0xfffa to int?Re: 请问DATAGRID里的BOUNDCOLUMN HEADER可以又有TEWindows Service Programming (转载)如何在C#环境下启动一个新的进程2005VS beta问题recommend a book to learn crystal reportHow to implement mirror sitesanswer.NET 新手 请教两个弱问题C#环境下调用C++函数的问题。access2003的sql的注释符号是什么?asp.net/IIS configuration problem讨厌的WARNING: 在 MANAGED C++ 中写东东 (转载)64 bits windows