【发布时间】:2018-08-18 00:46:41
【问题描述】:
我有一个视图 Email1.cshtml (Build Action=Embedded Resource):
@model Email1Model;
<html>
<head>
</head>
<body>
<h1>Hello, @Model.Name</h1>
</body>
</html>
我使用ViewRenderService 将cshtml 视图呈现为字符串。唯一的区别是我使用IRazorViewEngine.GetView() 而不是 FindView();
但是,在输出中我有一些应用洞察力:
<html> <head>
<script type="text/javascript">
var appInsights=window.appInsights||function(config){....);
window.appInsights=appInsights;
appInsights.trackPageView();
</script> </head> <body>
<h1>Hello, Liero</h1> </body> </html>
在startup.cs中:
services.AddApplicationInsightsTelemetry(opt => opt.InstrumentationKey = appInsightsKey);
问题:
如何在使用 ViewRenderService 渲染的特定视图中关闭 javascript?
【问题讨论】:
标签: razor asp.net-core asp.net-core-mvc asp.net-core-2.0 azure-application-insights