Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Would it be worth to remove the .aspx/.ascx lookup if I don't plan to use them?

Now that MVC 3 Preview 1 here, we can use Razor (.cshtml) view engine. If a view not found, I get this error:

The view 'a' or its master was not found. The following locations were searched:
~/Views/Home/a.aspx
~/Views/Home/a.ascx
~/Views/Shared/a.aspx
~/Views/Shared/a.ascx
~/Views/Home/a.cshtml
~/Views/Shared/a.cshtml

Would it be worth to remove the .aspx/.ascx lookup, if I don't plan to use them?

like image 423
stacker Avatar asked Jul 29 '10 12:07

stacker


2 Answers

I doubt you would gain any noticeable performance gain from that. It's merely a file check and if it's also cached by the engine there's hardly any performance improvement. I'd call it micro-optimization!

I guess if you know you won't be using WebForms, you could just remove it from the list of view engines, like so:

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());

That way it won't check for aspx/ascx files.

like image 98
aolde Avatar answered Oct 13 '22 00:10

aolde


The Code has been revised:

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
like image 37
superfrallan Avatar answered Oct 13 '22 00:10

superfrallan