Joh*_*han 18 content-type webmatrix razor
我想在我的WebMatrix cshtml文件中返回一些XML而不是HTML?如何更改内容类型标题?
Joh*_*han 24
使用.cshtml文件顶部的Response.ContentType属性,然后在视图内容中包含XML:
@{
Response.ContentType = "application/xml";
}
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>415-123-4567</Dial>
</Response>
Run Code Online (Sandbox Code Playgroud)
Mik*_*ike 19
在Razor文件的顶部,设置Response对象的ContentType:
@{
Response.ContentType = "application/xml";
}
... xml here ...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4093 次 |
| 最近记录: |