ASP.Net MVC- How to change master page for a view at runtime?
By [)ia6l0 iii
You can pass the master page name when you return the ViewResult from the Controller's Action.
For e.g, this would return the ViewResult with a new master page name.
public ActionResult TestToChangeMasterPage()
var view = View();
view.MasterName = "newMasterPageName";
If you browse your mvc pages, through modern day browsers like Chrome - you will find that there would be additional requests like the ones to the favicon. This is the icon, that appears to the left of the web address in the browser once the page loads.
ASP.Net 4.0 provides the SetSessionStateBehavior method through the HTTPContext Class.
Use the Override versions of the page methods instead of thedefault page methods. This would ensure that the .Net runtime does not have to invoke delegates.
Use the FilePathResult to return a file content as the http response.
You can check the contenttype of the request, and figure out if the request is an JSon request
This error most widely occurs due to a corrupt temporary asp.net file. You can clean the solution, delete the temporary asp.net files and rebuild your solution.
ASP.Net MVC- How to change master page for a view at runtime? (2651 Views)