2
나는 나무에 대한 나무를 볼 수 없습니다.왜이 문자열 형식 예외 던지고
왜 이것이 String Format Exception을 던집니까? 당신의 포맷 스트링의이 비트에
private const string GoogleAnalyticsFormat = @"<script type=""text/javascript"">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{0}']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>";
public static IHtmlString RenderGoogleAnalytics<T>(this HtmlHelpers<T> html, string trackingCode)
{
return html.Raw(string.Format(GoogleAnalyticsFormat, trackingCode));
}
에 괄호를
{
을 변경해야 할 당신이'{ '와'}'당신의 형식 끈. 당신은 그것들을 벗어날 필요가 있습니다. –