Nicely explained..
https://www.simple-talk.com/blogs/2013/02/27/tip-2-expanded-remove-unused-view-engines//
Just to tell long story short...
Sometimes we referenced View that may not exist in such case MVC framework throws error and specify that it tried to search view in different possible location but they do not exist,
Say--http://localhost/home
So View engine will try to search View\Home\index.chtml for source file but if the file don't exists it throws exception listing possible extension and location seach
WebFormViewEngine
~views/home/index.aspx
~views/home/index.ascx
~views/Shared/index.aspx
~views/Shared/index.ascx
RazorViewEngine
~views/home/index.chtml
~views/home/index.chtml
~views/Shared/index.chtml
so on.
~views/Shared/index.VBhtml
If we're using only RazorViewEngine then we can get rid of rest of ViewEngine just by adding below lines of code in Global.asax
ViewEngines.Engines.Clear();
https://www.simple-talk.com/blogs/2013/02/27/tip-2-expanded-remove-unused-view-engines//
Just to tell long story short...
Sometimes we referenced View that may not exist in such case MVC framework throws error and specify that it tried to search view in different possible location but they do not exist,
Say--http://localhost/home
So View engine will try to search View\Home\index.chtml for source file but if the file don't exists it throws exception listing possible extension and location seach
WebFormViewEngine
~views/home/index.aspx
~views/home/index.ascx
~views/Shared/index.aspx
~views/Shared/index.ascx
RazorViewEngine
~views/home/index.chtml
~views/home/index.chtml
~views/Shared/index.chtml
so on.
~views/Shared/index.VBhtml
If we're using only RazorViewEngine then we can get rid of rest of ViewEngine just by adding below lines of code in Global.asax
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
No comments :
Post a Comment