Note that there are some explanatory texts on larger screens.

plurals
  1. POAuthorize attribute breaks @Script.Render
    text
    copied!<p>I've got an ASP.Net MVC 4, .net 4.5 project with bundling. when I add [Authorize] to my Controller, the @Scripts.Render and @Styles.Render calls are breaking with 'Object reference not set to an instance of an object.'</p> <p>I can't for the life of me work out why!!</p> <p>Has anyone come across this before? can anyone help?</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Project.Models; using Project.Repositories; namespace Project.Controllers { [Authorize] public class HomeController : Controller </code></pre> <p>this breaks my _Layout view :</p> <pre><code>@model PageModel &lt;!DOCTYPE html&gt; &lt;!--[if lt IE 7]&gt; &lt;html class="no-js lt-ie9 lt-ie8 lt-ie7"&gt; &lt;![endif]--&gt; &lt;!--[if IE 7]&gt; &lt;html class="no-js lt-ie9 lt-ie8"&gt; &lt;![endif]--&gt; &lt;!--[if IE 8]&gt; &lt;html class="no-js lt-ie9"&gt; &lt;![endif]--&gt; &lt;!--[if gt IE 8]&gt;&lt;!--&gt; &lt;html class="no-js"&gt; &lt;!--&lt;![endif]--&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt; &lt;title&gt;Project&lt;/title&gt; &lt;meta name="description" content=""&gt; &lt;meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'/&gt;&lt;meta name="apple-mobile-web-app-capable" content="yes" /&gt; &lt;meta name="format-detection" content="telephone=no"&gt; @Styles.Render("~/Content/bootstrap") @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/initializr") </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload