1) What is Viewdata, ViewBag, Tempdata? Ans:
ViewData: It is of Type Viewdata dictionary derived from controller base class. It is used to send data from controller to view in the form of key-value pair. It handles current web request. ViewData is faster than viewBag. It can not handle complex data as it require typecasting
ViewBag: It is of type dynamic derived from controller base class.It is used to send data from controller to view in the form of object. It handles current web request. Type conversion code is not required. ViewBag is slower than viewdata
Tempdata:It is of Type key-value dictionary collection derived from controller base class. It is used to send data from between two consecutive request. To persist value in tempdata we can use keep() and peek() method
*If we set the value for tempdata and read it in view then data will be deleted
*If we read the tempdata value in first request and want to keep the value in next request then use keep method
*If we read the tempdata value using peek then value persist in next request also.
2) How can you test bundling in debug mode? Ans: We need to set EnableOptimizations to true in the bundleconfig.cs
BundleTable.EnableOptimizations = true:
3)How does bundling increase performance? Ans: Bundling improves the load time by reducing the number of requests to the Server and reducing the size of the requested JavaScript and CSS files by combining or bundling the multiple files into a single file
4)Difference between post and put? Ans: PUT is used to send data to a server to create/update a resource. The difference between POST and PUT is that PUT requests are idempotent. ... In contrast, calling a POST request repeatedly have side effects of creating the same resource multiple times.
No comments:
Post a Comment