<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3623174770832603697</id><updated>2024-11-08T20:52:26.203+05:30</updated><category term="Controller"/><category term="Create first simple MVC application"/><category term="MVC Introduction"/><category term="Model"/><category term="Mvc Life Cycle"/><category term="Razor Syntax"/><category term="Routing in mvc"/><category term="tempdata"/><title type='text'>TechnologyMvc</title><subtitle type='html'>ASP.NET MVC technology tutorials in simple and easy steps starting from Overview, explain ASP. NET MVC Technology application life cycle.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-4570439989081010555</id><published>2019-04-26T22:17:00.002+05:30</published><updated>2019-04-26T22:17:49.988+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="tempdata"/><title type='text'>tempdata</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;ASP.NET MVC offers us three options - TempData for passing data from controller to view and in next request.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihuURyv0fsUFcRUvsNCBMXE8tSDHQSfE55YXJom5PI2MGAjpSlzP28LtVrHlboMkzloNp_fe8kZY8gMxFhlSAacdlRZmoFDbEDPTrFgcVl8Xd6M1EEits7S0hTmXRxfGzy1RaKcSl5sI4g/s1600/tempdata.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;tempdata&quot; border=&quot;0&quot; data-original-height=&quot;491&quot; data-original-width=&quot;802&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihuURyv0fsUFcRUvsNCBMXE8tSDHQSfE55YXJom5PI2MGAjpSlzP28LtVrHlboMkzloNp_fe8kZY8gMxFhlSAacdlRZmoFDbEDPTrFgcVl8Xd6M1EEits7S0hTmXRxfGzy1RaKcSl5sI4g/s1600/tempdata.JPG&quot; title=&quot;tempdata&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;TempData &lt;/b&gt;is also a dictionary derived from &lt;b&gt;TempDataDictionary &lt;/b&gt;class and stored in short lives session and it is a string key and object value. The difference is the life cycle of the object. &lt;b&gt;TempDatakeeps &lt;/b&gt;the information for the time of an HTTP Request. This means only from one page to another. This also works with a 302/303 redirection because it’s in the same HTTP Request. It helps to maintain data when you move from one controller to another controller or from one action to other action. In other words, when you redirect, “Tempdata” helps to maintain data between those redirects. It internally uses session variables. Temp data use during the current and subsequent request only means it is used when you are sure that the next request will be redirecting to next view. It requires typecasting for complex data type and check for &lt;b&gt;null values&lt;/b&gt; to avoid an error. It is generally used to store only one time messages like error messages, validation messages.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-size: 15px; line-height: 22.5px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b style=&quot;background: 0px 0px rgb(255, 255, 255); border: 0px; color: #222222; font-size: 15px; line-height: 22.5px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Example:&amp;nbsp;&lt;/b&gt;&lt;b&gt;TempData&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;public ActionResult Index()&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; var model = new Review()&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Body = &quot;Start&quot;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Rating=5&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; TempData[&quot;Data&quot;] = model;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; return RedirectToAction(&quot;List&quot;);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;public ActionResult List()&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;{ &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; var model= TempData[&quot;Data&quot;]; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; return View(model);&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;1. TempData is a dictionary object that is derived from the TempDataDictionary class and stored in short lives session.&lt;br /&gt;&lt;br /&gt;2. TempData is used to pass data from current request to subsequent request (means redirecting from one page to another).&lt;br /&gt;&lt;br /&gt;3. Its life is very short and lies only till the target view is fully loaded.&lt;br /&gt;&lt;br /&gt;4. It’s required typecasting for getting data and check for null values to avoid the error.&lt;br /&gt;&lt;br /&gt;5. It’s used to store only one time messages like error messages, validation messages&lt;/span&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Persist data in TempData&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;The life of TempData is very short and lies only until the target view is fully loaded. But you can persist data in TempData by calling Keep() method after request completion&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;void Keep()&lt;/b&gt; - Calling this method within the current action ensures that all the items in TempData are not removed at the end of the current request.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;public ActionResult Index()&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;{ &amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; ViewBag.Message = TempData[&quot;Message&quot;];&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Student student = TempData[&quot;student&quot;] as Student;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; //need type casting TempData.Keep();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; //persist all strings values&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;return View();&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;void Keep(string key) &lt;/b&gt;- Calling this method within the current action ensures that specific item in TempData is not removed at the end of the current request.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;public ActionResult Index()&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;{&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; ViewBag.Message = TempData[&quot;Message&quot;];&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Student student = TempData[&quot;student&quot;] as Student; &amp;nbsp;//need type &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;casting&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;//persist only data for student key and Message key will be destroy&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;TempData.Keep(&quot;student&quot;);&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;return View();&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/4570439989081010555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/04/tempdata.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/4570439989081010555'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/4570439989081010555'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/04/tempdata.html' title='tempdata'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihuURyv0fsUFcRUvsNCBMXE8tSDHQSfE55YXJom5PI2MGAjpSlzP28LtVrHlboMkzloNp_fe8kZY8gMxFhlSAacdlRZmoFDbEDPTrFgcVl8Xd6M1EEits7S0hTmXRxfGzy1RaKcSl5sI4g/s72-c/tempdata.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-1649822921512368683</id><published>2019-04-26T20:32:00.000+05:30</published><updated>2019-04-26T20:32:47.663+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Create first simple MVC application"/><title type='text'>Create first simple MVC application</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px; text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 1.6; text-align: justify;&quot;&gt;First of all, open a Visual Studio 2013 for Web and click on a&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; line-height: 1.6; text-align: justify;&quot;&gt;New Project&lt;/b&gt;&lt;span style=&quot;line-height: 1.6; text-align: justify;&quot;&gt;&amp;nbsp;link in the&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; line-height: 1.6; text-align: justify;&quot;&gt;Start&lt;/b&gt;&lt;span style=&quot;line-height: 1.6; text-align: justify;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 1.6; text-align: justify;&quot;&gt;page&lt;/span&gt;&lt;span style=&quot;line-height: 1.6; text-align: justify;&quot;&gt;. Alternatively, you can also select&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; line-height: 1.6; text-align: justify;&quot;&gt;File menu&lt;/b&gt;&lt;span style=&quot;line-height: 1.6; text-align: justify;&quot;&gt;&amp;nbsp;-&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; line-height: 1.6; text-align: justify;&quot;&gt;New Project&lt;/b&gt;&lt;span style=&quot;line-height: 1.6; text-align: justify;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3X6lbxlAzI3MF4qQn4rg41n_2GNvyvyAJjscyvI0rM6FJNa6ZFm7g5-K3vO5UYQ5yynPzUI7iAdhLZqsXaXhAQnqZlojWkCWdfNa5G9fKmfLCPF2O6Kd32nkR6VIBtZtSpgl0FVRXONi6/s1600/first-mvc-app1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Create first simple MVC application&quot; border=&quot;0&quot; height=&quot;218&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3X6lbxlAzI3MF4qQn4rg41n_2GNvyvyAJjscyvI0rM6FJNa6ZFm7g5-K3vO5UYQ5yynPzUI7iAdhLZqsXaXhAQnqZlojWkCWdfNa5G9fKmfLCPF2O6Kd32nkR6VIBtZtSpgl0FVRXONi6/s640/first-mvc-app1.png&quot; title=&quot;Create first simple MVC application&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; font-size: 15px;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;From the&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; text-align: justify;&quot;&gt;New Project&lt;/b&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;&amp;nbsp;dialog as shown below, expand Visual C# node and select&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; text-align: justify;&quot;&gt;Web&lt;/b&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;&amp;nbsp;in the left pane, and then select&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; text-align: justify;&quot;&gt;ASP.NET Web Application&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;in the middle pane. Name your project MVC-BasicTutorials. (You can give any appropriate name for your application). Also, you can change the location of the MVC application by clicking on&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; text-align: justify;&quot;&gt;Browse..&lt;/b&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;&amp;nbsp;button. Finally, click&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; text-align: justify;&quot;&gt;OK.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; font-size: 15px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBeJ3kIfbLxaG06oBJkpBb57UX7XWvfuB6PKtNso9hhus64eyOQ2CDI8HJxzyafar-uXWFEaU_Na98aZ3C1Kebm-PFMHooJcAKeagrsYJ-LPXbX7zvicfXFmanroiBI5Uj8rtLKCjWN6U7/s1600/first-mvc-app2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Create first simple MVC application&quot; border=&quot;0&quot; height=&quot;387&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBeJ3kIfbLxaG06oBJkpBb57UX7XWvfuB6PKtNso9hhus64eyOQ2CDI8HJxzyafar-uXWFEaU_Na98aZ3C1Kebm-PFMHooJcAKeagrsYJ-LPXbX7zvicfXFmanroiBI5Uj8rtLKCjWN6U7/s640/first-mvc-app2.png&quot; title=&quot;Create first simple MVC application&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; font-size: 15px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-size: 15px;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;From the&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; text-align: justify;&quot;&gt;New ASP.NET Project&lt;/b&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;&amp;nbsp;dialog, select MVC as shown below.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #494949; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;background-color: white; margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikbUIVh7PINCdzUC9WU-ojX0j3Fkih4IEe8EEfLSSrvpFdiAGyEL7QE3c5GUhngfyslPTzZOYCcrKfpPYvPf3tAV68Skp0s9E4XGTBrC1HCD-DCBvuZpCTiZBEKr9ai-2X_KjQeRzw6fkv/s1600/first-mvc-app3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Create first simple MVC application&quot; border=&quot;0&quot; height=&quot;478&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikbUIVh7PINCdzUC9WU-ojX0j3Fkih4IEe8EEfLSSrvpFdiAGyEL7QE3c5GUhngfyslPTzZOYCcrKfpPYvPf3tAV68Skp0s9E4XGTBrC1HCD-DCBvuZpCTiZBEKr9ai-2X_KjQeRzw6fkv/s640/first-mvc-app3.png&quot; title=&quot;Create first simple MVC application&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;font-size: 12.8px;&quot;&gt;Add caption&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #494949; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; font-size: 15px;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;You can also change the authentication by clicking on&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; text-align: justify;&quot;&gt;Change Authentication&lt;/b&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;&amp;nbsp;button. You can select appropriate authentication mode for your application. Here, we are not going to have any authentication for our application. So select&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; text-align: justify;&quot;&gt;No Authentication&lt;/b&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;&amp;nbsp;radio button and click&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box; color: #494949; text-align: justify;&quot;&gt;OK&lt;/b&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;. (By default, Individual User Accounts would be selected to authenticate users stored in SQL Server database.)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #494949; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqZIgulH9fYYVCqkjXbdnzdzEjw0MLmOkhB3awlczxWqAQ_UcFdb-a5hH8eGjVBrfuh9I_qXh2GYSWqFImlIX_DmN-tW9ch-CW3CbRrX8jcTdprRiuuJFES-FrkxiDj83RhMl1yTUVRHF0/s1600/first-mvc-app4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Create first simple MVC application&quot; border=&quot;0&quot; height=&quot;282&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqZIgulH9fYYVCqkjXbdnzdzEjw0MLmOkhB3awlczxWqAQ_UcFdb-a5hH8eGjVBrfuh9I_qXh2GYSWqFImlIX_DmN-tW9ch-CW3CbRrX8jcTdprRiuuJFES-FrkxiDj83RhMl1yTUVRHF0/s640/first-mvc-app4.png&quot; title=&quot;Create first simple MVC application&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #494949; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 15px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; font-size: 15px;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;Wait for some time till Visual Studio creates a simple MVC project using default template as shown below.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #494949; font-size: 15px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPN1xnUeH0LhMOB7vZSDhfOxK8rSJwwn53-jK2LpWkZwOio-FJUf7owJSU9wjhdY-G3kaDyi2qI7UDG5PVaK3kLpwnfC_gCJmw7UBCxIAJUAZCUlAUirUs2ctiKhGKogmJvKmRgh_7zK8q/s1600/first-mvc-app6.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Create first simple MVC application&quot; border=&quot;0&quot; height=&quot;296&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPN1xnUeH0LhMOB7vZSDhfOxK8rSJwwn53-jK2LpWkZwOio-FJUf7owJSU9wjhdY-G3kaDyi2qI7UDG5PVaK3kLpwnfC_gCJmw7UBCxIAJUAZCUlAUirUs2ctiKhGKogmJvKmRgh_7zK8q/s640/first-mvc-app6.png&quot; title=&quot;Create first simple MVC application&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; font-size: 15px;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;Now, press F5 to run the project in debug mode or Ctrl + F5 to run the project without debugging. It will open home page in the browser as shown below.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #494949; font-size: 15px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #494949; font-size: 15px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiCLDB36PUq0BoDBka371aX9gsIxRazEAtUs0-Sts7EgsPO6xo8iyarSkX3yN2qUnDJdLbcG4pkNBFSBTq-nzqgKmqvDovS1fKt5ZosWVKGlBfykLFZGSzBcGFs_C9yE12X3AuFJ5Vc33D/s1600/first-mvc-app7.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Create first simple MVC application&quot; border=&quot;0&quot; height=&quot;326&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiCLDB36PUq0BoDBka371aX9gsIxRazEAtUs0-Sts7EgsPO6xo8iyarSkX3yN2qUnDJdLbcG4pkNBFSBTq-nzqgKmqvDovS1fKt5ZosWVKGlBfykLFZGSzBcGFs_C9yE12X3AuFJ5Vc33D/s640/first-mvc-app7.png&quot; title=&quot;Create first simple MVC application&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; line-height: 25.6px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #494949; font-size: 15px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; clear: both; font-size: 15px;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #494949; text-align: justify;&quot;&gt;MVC 5 project includes JavaScript and CSS files of bootstrap 3.0 by default. So you can create responsive web pages. This responsive UI will change its look and feel based on the screen size of the different devices. For example, top menu bar will be changed in the mobile devices as shown below.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/1649822921512368683/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/04/CreatefirstsimpleMVCapplication.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/1649822921512368683'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/1649822921512368683'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/04/CreatefirstsimpleMVCapplication.html' title='Create first simple MVC application'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3X6lbxlAzI3MF4qQn4rg41n_2GNvyvyAJjscyvI0rM6FJNa6ZFm7g5-K3vO5UYQ5yynPzUI7iAdhLZqsXaXhAQnqZlojWkCWdfNa5G9fKmfLCPF2O6Kd32nkR6VIBtZtSpgl0FVRXONi6/s72-c/first-mvc-app1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-2068403990201769537</id><published>2019-04-09T15:19:00.001+05:30</published><updated>2019-04-26T19:54:35.773+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Controller"/><title type='text'>Viewbag</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;We have learned &lt;b&gt;Viewbag&amp;nbsp;&lt;/b&gt;in the previous section that the model object is used to send data in a razor view. However, there may be some scenario where you want to send a small amount of temporary data to the view. So for this reason, MVC framework includes ViewBag.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;It is used to allow you to share values dynamically. There are several variables that are not known before the program is run, and these values are only entered during runtime. And this is where it shines, because you can put just about anything you want in ViewBag.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;ViewBag can be useful when you want to transfer temporary data (which is not included in model) from the controller to the view. The viewBag is a dynamic type property of ControllerBase class which is the base class of all the controllers.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The following figure illustrates the ViewBag.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgvoSFpSY7yqGmhyVcIyP0xEJpsxv-se2UBJY52rQJcmGzurGh3UUMHDpVt-A3G5orOhzDxYvaUFLK4n4M3EFuBzZyJV1_ka4eUfxNY38p93UdC3S-UFqTxn6Sa-PCkcl1yDS91k01WTXc/s1600/ASP.NET+MVC+-+ViewBag.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;viewbag&quot; border=&quot;0&quot; data-original-height=&quot;277&quot; data-original-width=&quot;847&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgvoSFpSY7yqGmhyVcIyP0xEJpsxv-se2UBJY52rQJcmGzurGh3UUMHDpVt-A3G5orOhzDxYvaUFLK4n4M3EFuBzZyJV1_ka4eUfxNY38p93UdC3S-UFqTxn6Sa-PCkcl1yDS91k01WTXc/s1600/ASP.NET+MVC+-+ViewBag.PNG&quot; title=&quot;viewbag&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;In the above figure, it attaches Name property to ViewBag with the dot notation and assigns a string value &quot;Rohit&quot; to it in the controller. This can be accessed in the view like &lt;b&gt;@ViewBag.Name.&lt;/b&gt; (@ is razor syntax to access the server side variable.)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;You can assign any number of properties and values to ViewBag. If you assign the same property name multiple times to ViewBag, then it will only consider last value assigned to the property.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Note:&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;ViewBag only transfers data from controller to view, not visa-versa. ViewBag values will be null if redirection occurs.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The following example demonstrates how to transfer data from controller to view using ViewBag&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: large;&quot;&gt;Example: Set ViewBag in Action method&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;namespace MymvcFirstApplication.Controllers&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; public class StudentController : Controller&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IList&lt;student&gt; studentList = new List&lt;student&gt;() {&amp;nbsp;&lt;/student&gt;&lt;/student&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new Student(){ StudentID=1, StudentName=&quot;Rohit&quot;, Age = 21 },&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new Student(){ StudentID=2, StudentName=&quot;Rames&quot;, Age = 25 },&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new Student(){ StudentID=3, StudentName=&quot;Ronak&quot;, Age = 20 },&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new Student(){ StudentID=4, StudentName=&quot;Ritik&quot;, Age = 31 },&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new Student(){ StudentID=5, StudentName=&quot;Rahul&quot;, Age = 19 }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new Student(){ StudentID=6, StudentName=&quot;Rokl&quot;, Age = 23}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // GET: Student&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult Index()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ViewBag.TotalStudents = studentList.Count();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return View();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;In the above example, we want to display the total number of students in a view for the demo. So, we have attached the TotalStudents property to the ViewBag and assigned the student count using &lt;b&gt;studentList.Count().&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Now, in the Index.cshtml view, you can access ViewBag.TotalStudents property and display all the student info as shown below.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;Example: Acess ViewBag in a View&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;label&gt;Total Students:&lt;/label&gt; &amp;nbsp;@ViewBag.TotalStudents&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;Output&lt;/b&gt;&lt;b&gt;:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;Total Students: 6&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;ViewBag doesn&#39;t require typecasting while retriving values from it&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Points to Remember :&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;1.ViewBag transfers data from the controller to the view, ideally temporary data which in not included in a model.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;2.ViewBag is a &lt;b&gt;dynamic property&lt;/b&gt; that takes advantage of the new dynamic features in C# 4.0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;3.You can assign any number of propertes and values to ViewBag&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;4.The ViewBag&#39;s life only lasts during the current http request. ViewBag values will be null if redirection occurs.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;5.ViewBag is actually a wrapper around ViewData&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/2068403990201769537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/04/viewbag.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/2068403990201769537'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/2068403990201769537'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/04/viewbag.html' title='Viewbag'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgvoSFpSY7yqGmhyVcIyP0xEJpsxv-se2UBJY52rQJcmGzurGh3UUMHDpVt-A3G5orOhzDxYvaUFLK4n4M3EFuBzZyJV1_ka4eUfxNY38p93UdC3S-UFqTxn6Sa-PCkcl1yDS91k01WTXc/s72-c/ASP.NET+MVC+-+ViewBag.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-6971866299677266783</id><published>2019-04-04T13:56:00.001+05:30</published><updated>2019-04-26T19:55:55.576+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Razor Syntax"/><title type='text'>Razor Syntax in MVC</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
 &lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;br /&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState=&quot;false&quot; LatentStyleCount=&quot;156&quot;&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Table Normal&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0in 5.4pt 0in 5.4pt;
 mso-para-margin:0in;
 mso-para-margin-bottom:.0001pt;
 mso-pagination:widow-orphan;
 font-size:10.0pt;
 font-family:&quot;Times New Roman&quot;;
 mso-ansi-language:#0400;
 mso-fareast-language:#0400;
 mso-bidi-language:#0400;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdvttmO0Zi_NyxQgL3CDNjpf-pCUGU2DHn-CR_v1wBtWkWUBWWF2ro6ieRnzSntRNnNyEUbKKh8WnNyFO-wYk2280rhndVY7GivInEIQLKYXi2BafKpQqJtbqsDMGRGkP24fhmQfMFd-_G/s1600/Razor+Syntax+in+MVC-min.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Razor Syntax in MVC&quot; border=&quot;0&quot; data-original-height=&quot;288&quot; data-original-width=&quot;432&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdvttmO0Zi_NyxQgL3CDNjpf-pCUGU2DHn-CR_v1wBtWkWUBWWF2ro6ieRnzSntRNnNyEUbKKh8WnNyFO-wYk2280rhndVY7GivInEIQLKYXi2BafKpQqJtbqsDMGRGkP24fhmQfMFd-_G/s1600/Razor+Syntax+in+MVC-min.jpg&quot; title=&quot;Razor Syntax in MVC&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&amp;nbsp;&lt;b&gt;Razor is one of the view engine supported in&lt;/b&gt; ASP.NET MVC. Razor allows you to write mix of HTML and &lt;b&gt;server side code&lt;/b&gt; using C# or Visual Basic. Razor view with visual basic syntax has .vbhtml file extension and C# syntax has .cshtml file extension.&lt;br /&gt;
&lt;br /&gt;
Razor syntax has following Characteristics:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;Compact&lt;/b&gt;: Razor syntax is compact which enables you to minimize number of characters and keystrokes required to write a code.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;Easy to Learn:&lt;/b&gt; Razor syntax is easy to learn where you can use your familiar language C# or Visual Basic.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;Intellisense:&lt;/b&gt; Razor syntax supports statement completion within Visual Studio.&lt;br /&gt;
&lt;br /&gt;
how to write razor code. &lt;br /&gt;
Start with &lt;b&gt;@&lt;/b&gt; symbol to write server side C# or VB code with Html code. For example, write @Variable_Name to display a value of a server side variable. For example, DateTime.Now returns a current date and time. So, write &lt;b&gt;@DateTime&lt;/b&gt;.Now to display current system datetime as shown below. A single line expression does not require a semicolon at the end of the expression&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Razor Syntax of example&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
C# Razor Syntax&lt;br /&gt;
Razor syntax demo &lt;br /&gt;
&lt;br /&gt;
@DateTime.Now.ToShortDateString()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;
Razor syntax demo&lt;br /&gt;
22-12-2018 //Current date show my computer system&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Multi-statement Code bloc&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
You can write multiple line of server side code enclosed in braces @{ ... }. &lt;br /&gt;
Each line must ends with semicolon same as C#. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;nbsp;Example: Server side Code in Razor Syntax &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
@{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var date = DateTime.Now.ToShortDateString();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var message = &quot;Hello Friends&quot;;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Today&#39;s date is: @date &lt;br /&gt;
&lt;br /&gt;
@message&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;Today&#39;s date is: 08-09-2014&lt;br /&gt;
&amp;nbsp;Hello World!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Display Text from Code Block&amp;nbsp; &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Use @: or &lt;text&gt;/&lt;text&gt; to display&lt;br /&gt;&lt;br /&gt;texts within code block. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example: Display Text in Razor Syntax&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;@{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var date = DateTime.Now.ToShortDateString();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string message = &quot;Hello World!&quot;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @:Today&#39;s date is: @date &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @message&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Today&#39;s date is: 08-09-2014&lt;br /&gt;&lt;br /&gt;Hello World!&lt;br /&gt;&lt;br /&gt;Display text using &lt;text&gt; within a code block as shown below.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example: Text in Razor Syntax&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var date = DateTime.Now.ToShortDateString();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string message = &quot;Hello World!&quot;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;text&gt;Today&#39;s date is:&lt;/text&gt; @date &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @message&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Today&#39;s date is: 08-09-2014&lt;br /&gt;Hello World!&lt;/text&gt;&lt;/text&gt;&lt;/text&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Condition Write&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;If statement&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;It starts with code block and its condition is written in parenthesis. And the code which needs to be executed once condition gets satisfied is written inside braces.&lt;br /&gt;&lt;br /&gt;Let’s understand with the below example.&lt;br /&gt;&lt;br /&gt;@{var price=60;} &lt;br /&gt;&lt;html&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;body&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @if (price&amp;gt;50) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The price is&amp;nbsp; greater than 50.&lt;br /&gt;
 &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/body&gt; &amp;nbsp;&lt;/html&gt; &lt;br /&gt;In the above example, we have declared var price has a value of 60 and we are using if statement which is validating price. If the price is greater than 50 then the code written in side braces gets executed.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;If – Else statement&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;It starts with code block and its condition is written in parenthesis. And code which needs to be executed once the condition gets satisfied is written inside braces and if it does not gets satisfied then code written inside else block gets executed.&lt;br /&gt;&lt;br /&gt;Let’s understand with the below example.&lt;br /&gt;&lt;br /&gt;@{var price=60;} &lt;br /&gt;&lt;html&gt; &lt;br /&gt;&lt;body&gt; &lt;br /&gt;@if (price&amp;gt;50) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The price is&amp;nbsp; greater than 50.&lt;br /&gt;
 &lt;br /&gt;&amp;nbsp;} &lt;br /&gt;&amp;nbsp; &lt;br /&gt;else &lt;br /&gt;&amp;nbsp; { &lt;br /&gt;&amp;nbsp; The price is less than 50.&lt;br /&gt;
 &lt;br /&gt;&amp;nbsp; }&amp;nbsp; &lt;br /&gt;&amp;nbsp; &lt;/body&gt; &amp;nbsp;&lt;/html&gt; &lt;br /&gt;In the above example, we have declared var price having a value of 60 and we are using if statement which is validating price. If the price is greater than 50 then the code written inside braces gets executed else the price is less than 50 and it will get executed.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Loops&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Loops are used for executingthe&amp;nbsp; same statement multiple times.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;For Loops&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;If you know how many times you want to run the loop, you can use a For loop.&lt;br /&gt;&lt;br /&gt;&lt;html&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;body&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @for(var i = 0; i &amp;lt; 10; i++) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {No @i&lt;br /&gt;
} &lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/body&gt; &amp;nbsp;&lt;/html&gt;&amp;nbsp; &lt;html&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;body&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @for(var i = 0; i &amp;lt; 10; i++) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {No @i&lt;br /&gt;
} &lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/body&gt; &amp;nbsp;&lt;/html&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;For Each Loops&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Foreach loop is used when you are working with collections or an array.&lt;br /&gt;&lt;br /&gt;&lt;html&gt; &lt;br /&gt;&lt;body&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;ul&gt; @foreach (var x in Request.ServerVariables) { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;li&gt;@x&lt;/li&gt;
} &lt;/ul&gt;
&amp;nbsp;&lt;/body&gt; &amp;nbsp;&lt;/html&gt; &lt;html&gt; &lt;br /&gt;&lt;body&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;ul&gt; @foreach (var x in Request.ServerVariables) { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;li&gt;@x&lt;/li&gt;
} &lt;/ul&gt;
&amp;nbsp;&lt;/body&gt; &amp;nbsp;&lt;/html&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Model &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Use @model to use model object anywhere in the view. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example: Use Model in Razor &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
@model Book&lt;br /&gt;
&amp;nbsp;BookDetail:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; BookId: @Model.BookId&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Book Name: @Model.BookName&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Book Page: @Model.BookPage&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;Book Detail :&lt;br /&gt;
&lt;br /&gt;
- BookId: 1001 &lt;br /&gt;
&lt;br /&gt;
- Book Name: Abc&lt;br /&gt;
&lt;br /&gt;
- Book Page: 18&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Declare Variables&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Declare a variable in a code block enclosed in brackets and then use those&lt;br /&gt;
variables inside html with &lt;b&gt;@ symbol.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example: Variable in Razor &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
@{ &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; string str = &quot;&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;if(1 &amp;gt; 0)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str = &quot;Hello World!&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;@str&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Output:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Hello World!&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/6971866299677266783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/04/razor-syntax-in-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/6971866299677266783'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/6971866299677266783'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/04/razor-syntax-in-mvc.html' title='Razor Syntax in MVC'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdvttmO0Zi_NyxQgL3CDNjpf-pCUGU2DHn-CR_v1wBtWkWUBWWF2ro6ieRnzSntRNnNyEUbKKh8WnNyFO-wYk2280rhndVY7GivInEIQLKYXi2BafKpQqJtbqsDMGRGkP24fhmQfMFd-_G/s72-c/Razor+Syntax+in+MVC-min.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-2392489337983707867</id><published>2019-03-21T11:51:00.000+05:30</published><updated>2019-04-26T19:59:12.363+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Model"/><title type='text'>Model in MVC</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14pt;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;In this section, you will learn about the
&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Model&lt;/span&gt; in ASP.NET MVC&lt;span style=&quot;font-weight: normal;&quot;&gt; framework&lt;/span&gt;.&lt;/span&gt;&lt;/h1&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14.0pt;&quot;&gt;Model represents domain specific data and
&lt;b&gt;business logic&lt;/b&gt; in MVC architecture. It maintains the data of the application.
Model objects retrieve and store model state in the persistance store like a
&lt;b&gt;database&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14.0pt;&quot;&gt;Model class holds data in &lt;b&gt;public properties&lt;/b&gt;.
All the &lt;b&gt;Model classes &lt;/b&gt;reside in the Model folder in MVC folder structure. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14.0pt;&quot;&gt;Let&#39;s see how to add model class in ASP.NET
MVC. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h2&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14.0pt;&quot;&gt;Adding a Model&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14.0pt;&quot;&gt;Open our first MVC project created in
previous step in the Visual Studio. Right click on Model folder -&amp;gt; Add -&amp;gt;
click on Class.. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14.0pt;&quot;&gt;In the Add New Item dialog box, enter class
name &#39;Student&#39; and click &lt;strong&gt;Add&lt;/strong&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;figure&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNMxd-h3Ko0wvfR6wlZsMn5qIvNaboYzV662eghr1FeaHfCNDJ434Syzpwk5nLRXV9kpGDpUs7m9WE6LOmAVxgCrYfytVAq4Ky1WIL7N0Z-KA4_I9rZrwoPhF7HOFXItRvJu5mD5Okox5H/s1600/Model+in+ASP.NET+MVC.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;img alt=&quot;Model in MVC&quot; border=&quot;0&quot; data-original-height=&quot;597&quot; data-original-width=&quot;687&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNMxd-h3Ko0wvfR6wlZsMn5qIvNaboYzV662eghr1FeaHfCNDJ434Syzpwk5nLRXV9kpGDpUs7m9WE6LOmAVxgCrYfytVAq4Ky1WIL7N0Z-KA4_I9rZrwoPhF7HOFXItRvJu5mD5Okox5H/s1600/Model+in+ASP.NET+MVC.jpg&quot; title=&quot;Model in MVC&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Create
Model Class&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;br /&gt;


&lt;/span&gt;&lt;/figure&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14.0pt;&quot;&gt;This will add new Student class in model
folder. Now, add &amp;nbsp;Id, Name, Addredss, Age, Gender properties as shown below. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14.0pt;&quot;&gt;For Example: Model class&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14.0pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;namespace FirstMVCApplication.Models&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;{&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; public class Student&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public int Student_Id { get; set; }&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string Name { get; set; &amp;nbsp;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string Address{ get; set; &amp;nbsp;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string Age { get; set; &amp;nbsp;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string gender { get; set; &amp;nbsp;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14.0pt;&quot;&gt;So in this way, you can create a model class
which you can use in View. You will learn how to implement validations using
model later. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 14pt;&quot;&gt;Learn how to create a View in the next section&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/2392489337983707867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/model-in-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/2392489337983707867'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/2392489337983707867'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/model-in-mvc.html' title='Model in MVC'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNMxd-h3Ko0wvfR6wlZsMn5qIvNaboYzV662eghr1FeaHfCNDJ434Syzpwk5nLRXV9kpGDpUs7m9WE6LOmAVxgCrYfytVAq4Ky1WIL7N0Z-KA4_I9rZrwoPhF7HOFXItRvJu5mD5Okox5H/s72-c/Model+in+ASP.NET+MVC.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-5768979785411513802</id><published>2019-03-20T20:04:00.003+05:30</published><updated>2019-04-26T20:00:24.169+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Controller"/><title type='text'>Action selectors in Mvc</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;article class=&quot;article&quot;&gt;
    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgxZHNbZjguRO3zblNRe8RdJIzAc3FGjv0zYBZAAos1xGq6cIYNbBMdG42kP_-8AWrhuXtcvCLAi6L6P0OBYsPQUyeqrm7N93c1xXAxdOwblmNElWeNn7jULgZrtI6MYP-ZeC6cwtNX8S_/s1600/Action+selectors+in+Mvc.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Action selectors in Mvc&quot; border=&quot;0&quot; data-original-height=&quot;361&quot; data-original-width=&quot;465&quot; height=&quot;247&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgxZHNbZjguRO3zblNRe8RdJIzAc3FGjv0zYBZAAos1xGq6cIYNbBMdG42kP_-8AWrhuXtcvCLAi6L6P0OBYsPQUyeqrm7N93c1xXAxdOwblmNElWeNn7jULgZrtI6MYP-ZeC6cwtNX8S_/s320/Action+selectors+in+Mvc.jpg&quot; title=&quot;Action selectors in Mvc&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;u&gt;Action Selectors&lt;/u&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1&gt;

&lt;span style=&quot;font-size: small;&quot;&gt;Action selector&lt;span style=&quot;font-weight: normal;&quot;&gt; is the attribute that can be applied to the action methods.
It helps routing engine to select the correct action method to handle a
particular request. MVC 5 includes the following action selector attributes: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;


&lt;span style=&quot;font-size: small;&quot;&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;ActionName&lt;/li&gt;
&lt;li&gt;NonAction&lt;/li&gt;
&lt;li&gt;ActionVerbs&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
1. ActionName
&lt;/span&gt;&lt;ol start=&quot;1&quot; type=&quot;1&quot;&gt;
&lt;/ol&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;ActionName attribute allows us to specify a different action name than the
method name. Consider the following example.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1&gt;


&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Example: ActionName &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;BookController&lt;/span&gt;&lt;code&gt; : &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;Controller&lt;/span&gt;&lt;code&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;BookController&lt;/span&gt;&lt;code&gt;()&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #38761d; font-weight: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;[&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;&lt;span class=&quot;userclass&quot;&gt;ActionName&lt;/span&gt;&lt;code&gt;(&lt;/code&gt;&lt;span class=&quot;str&quot;&gt;&quot;find&quot;&lt;/span&gt;&lt;/span&gt;&lt;code&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;)]&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;ActionResult&lt;/span&gt;&lt;code&gt; GetById(&lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt;&lt;code&gt; id)&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;span class=&quot;rem&quot;&gt;// get Book from the database&lt;/span&gt;&lt;code&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt;&lt;code&gt; View();&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;In the above example, we have applied &lt;code&gt;ActioName(&quot;find&quot;)&lt;/code&gt;
attribute to GetById action method. So now, action name is &quot;find&quot;
instead of &quot;GetById&quot;. This action method will be invoked on http://localhost/Boook/find/&lt;i&gt;1&lt;/i&gt;
request instead of http://localhost/Book/getbyid/1
request. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;


&lt;/h1&gt;
&lt;h2&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;3. NonAction&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h1&gt;

&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NonAction selector attribute indicates that a public method of a Controller
is not an action method. Use NonAction attribute when you want public method in
a controller but do not want to treat it as an action method. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;


&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;For example, the GetStudent() public method cannot be invoked in the same
way as action method in the following example. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;


&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Example: NonAction&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;BookController&lt;/span&gt;&lt;code&gt; : &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;Controller&lt;/span&gt;&lt;code&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;BookController&lt;/span&gt;&lt;code&gt;()&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #38761d; font-weight: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;[&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;NonAction&lt;/span&gt;&lt;/span&gt;&lt;code&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-weight: normal;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;Book&lt;/span&gt;&lt;code&gt; GetBook(&lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt;&lt;code&gt; id)&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt;&lt;code&gt; BookList.Where(s =&amp;gt; s.BookId == id).FirstOrDefault();&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/h1&gt;
&lt;h1&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;3. ActionVerbs &amp;nbsp;&lt;/span&gt;&lt;/h1&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-size: 16px; line-height: 22px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;You can apply these attributes to action method to indicate the kind of Http request the action method supports. If you do not apply any attribute then it considers it a GET request by default&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;span style=&quot;background-color: white; color: #4e4e4e; font-size: small; line-height: 42px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;[HttpGet], [HttpPost], [HttpPut], [HttpDelete] Attributes in ActionSelectors&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #4e4e4e; font-size: 14px; font-weight: normal; line-height: 22px; margin-bottom: -3px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;[HttpGet]&lt;/span&gt;&amp;nbsp;- It is used to restrict an action method&amp;nbsp;to handle&amp;nbsp;only HTTP GET requests.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #4e4e4e; font-size: 14px; font-weight: normal; line-height: 22px; margin-bottom: -3px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #4e4e4e; font-size: 14px; font-weight: normal; line-height: 22px; margin-bottom: -3px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;[HttpPost]&lt;/span&gt;&amp;nbsp;- It is used to restrict an action method to handle only HTTP POST requests.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #4e4e4e; font-size: 14px; font-weight: normal; line-height: 22px; margin-bottom: -3px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #4e4e4e; font-size: 14px; font-weight: normal; line-height: 22px; margin-bottom: -3px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;[HttpPut]&lt;/span&gt;&amp;nbsp;- It is used to restrict an action method&amp;nbsp;to handle&amp;nbsp;only HTTP PUT requests.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #4e4e4e; font-size: 14px; font-weight: normal; line-height: 22px; margin-bottom: -3px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #4e4e4e; font-size: 14px; font-weight: normal; line-height: 22px; margin-bottom: -3px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;[HttpDelete]&lt;/span&gt;&amp;nbsp;- It is used to restrict an action method&amp;nbsp;to handle&amp;nbsp;only HTTP DELETE requests.&lt;/span&gt;&lt;/div&gt;
&lt;/h1&gt;
&lt;h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Example:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;ActionVerbs &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/h1&gt;
&lt;h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;BookController&lt;/span&gt;&lt;code&gt; : &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;Controller&lt;/span&gt;&lt;code&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt;&lt;code&gt; &lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;BookController&lt;/span&gt;&lt;code&gt;()&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #38761d; font-weight: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;[&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;userclass&quot;&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;HttpGet&lt;/span&gt;&lt;/span&gt;&lt;code&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;]&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;color: #38761d; font-size: medium; font-weight: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: #38761d; font-size: small; font-weight: normal;&quot;&gt;public&lt;/span&gt;&lt;code style=&quot;color: #38761d; font-size: medium; font-weight: normal;&quot;&gt; &lt;/code&gt;&lt;span class=&quot;userclass&quot; style=&quot;color: #38761d; font-size: small; font-weight: normal;&quot;&gt;Book&lt;/span&gt;&lt;code style=&quot;color: #38761d; font-size: medium; font-weight: normal;&quot;&gt; GetBook(&lt;/code&gt;&lt;span class=&quot;kwrd&quot; style=&quot;color: #38761d; font-size: small; font-weight: normal;&quot;&gt;int&lt;/span&gt;&lt;code style=&quot;color: #38761d; font-size: medium; font-weight: normal;&quot;&gt; id)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt;&lt;code&gt; BookList.Where(s =&amp;gt; s.BookId == id).FirstOrDefault();&lt;o:p&gt;&lt;/o:p&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/h1&gt;
&lt;h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Points to Remember :&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;card-body&quot;&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;MVC framework routing engine uses Action Selectors attributes to determine which action method to invoke.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;&amp;nbsp; Three action selectors attributes are available in MVC 5:&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;card-body&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ActionName,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NonAction,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;ActionVerbs&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small; font-weight: normal;&quot;&gt;ActionName attribute is used to specify different name of action than method name.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;NonAction attribute marks the public method of controller class as non-action method. It cannot be invoked. &amp;nbsp;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
            &lt;/ol&gt;
&lt;/div&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;/h1&gt;
&lt;h1&gt;
&lt;article class=&quot;article&quot;&gt;&lt;div class=&quot;card points&quot;&gt;
&lt;div class=&quot;card-body&quot;&gt;
&lt;ol&gt;
            &lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/article&gt;&lt;/h1&gt;
&lt;/article&gt;&lt;article class=&quot;article&quot;&gt;&lt;div class=&quot;card points&quot;&gt;
&lt;div class=&quot;card-body&quot;&gt;
&lt;ol&gt;
            &lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/article&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/5768979785411513802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/action-selectors-in-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/5768979785411513802'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/5768979785411513802'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/action-selectors-in-mvc.html' title='Action selectors in Mvc'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgxZHNbZjguRO3zblNRe8RdJIzAc3FGjv0zYBZAAos1xGq6cIYNbBMdG42kP_-8AWrhuXtcvCLAi6L6P0OBYsPQUyeqrm7N93c1xXAxdOwblmNElWeNn7jULgZrtI6MYP-ZeC6cwtNX8S_/s72-c/Action+selectors+in+Mvc.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-322936297975942071</id><published>2019-03-20T14:40:00.002+05:30</published><updated>2019-04-26T20:05:37.867+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Controller"/><title type='text'>Action methods in mvc</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;background: white; margin-bottom: .0001pt; margin: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;Understanding&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;Controllers&lt;a href=&quot;https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/controllers-and-routing/aspnet-mvc-controllers-overview-cs#understanding-controllers&quot;&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6-hVxG6xDsxdtKch9YKaEj6BXQrE0OcV2Ww1Ubnwpvi2GpqWV24cGgab_rTWhipZbj6fhg6l6cDXAl3kMLqlk8m0BI35btmxsZkhequUuYR-L-HkKmC3YRmD1laFh8N-Pe2ml8HZrqHIW/s1600/controller-action-methods-in-mvc.png&quot; imageanchor=&quot;1&quot; style=&quot;font-family: &#39;Times New Roman&#39;; margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;Action methods in mvc&quot; border=&quot;0&quot; data-original-height=&quot;175&quot; data-original-width=&quot;489&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6-hVxG6xDsxdtKch9YKaEj6BXQrE0OcV2Ww1Ubnwpvi2GpqWV24cGgab_rTWhipZbj6fhg6l6cDXAl3kMLqlk8m0BI35btmxsZkhequUuYR-L-HkKmC3YRmD1laFh8N-Pe2ml8HZrqHIW/s1600/controller-action-methods-in-mvc.png&quot; title=&quot;Action methods in mvc&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;MVC controllers are responsible for responding to requests made
against an ASP.NET MVC website. Each browser request is mapped to a particular
controller. For example, imagine that you enter the following URL into the
address bar of your browser:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;code&gt;&lt;span style=&quot;border: 1pt solid rgb(227, 227, 227); font-size: 10pt; padding: 3pt;&quot;&gt;http://localhost/Student/Index&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;In this case, a controller named StudentController is invoked. The
StudentController is responsible for generating the response to the browser
request. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;For example, the controller might return a particular view back to
the browser or the controller might redirect the user to another controller.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;Listing 1 contains a simple controller named StudentController.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; margin-bottom: 0in;&quot;&gt;
&lt;div style=&quot;line-height: 21.45pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;Listing1 - Controllers\StudentController.cs&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Collections.Generic;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Linq;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Web;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Web.Mvc;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Web.Mvc.Ajax;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;namespace FirstMvcApplication1.Controllers&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; public class StudentController : Controller&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // GET: /Student/&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult Index()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Add action logic here&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return View();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;}&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;As you can see from Listing 1, a controller is just a class (a
Visual Basic .NET or C# class). A controller is a class that derives from the
base &lt;b&gt;System.Web.Mvc.Controller class&lt;/b&gt;.
Because a controller inherits from this base class, a controller inherits
several useful methods for free &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp; (We discuss these methods
in a moment).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;background: white; margin-bottom: .0001pt; margin: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;Understanding Controller Actions&lt;a href=&quot;https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/controllers-and-routing/aspnet-mvc-controllers-overview-cs#understanding-controller-actions&quot;&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;A controller exposes controller actions. An action is a method on
a controller that gets called when you enter a particular URL in your browser
address bar. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;For example, imagine that you make a request for the following
URL:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;code&gt;&lt;b&gt;&lt;span style=&quot;border: 1pt solid rgb(227, 227, 227); font-size: 10pt; padding: 3pt;&quot;&gt;http://localhost/Student/Index&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;In this case, the &lt;b&gt;Index()
method&lt;/b&gt; is called on the &lt;b&gt;StudentController
class&lt;/b&gt;. The Index() method is an example of a controller action.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;A controller action must be a &lt;b&gt;public&lt;/b&gt;
method of a controller class. C# methods, by default, are &lt;b&gt;private&lt;/b&gt; methods. Realize that any public method that you add to a
controller class is exposed as a controller action automatically &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;(You must be careful about this since a controller action can be
invoked by anyone in the universe simply by typing the right URL into a browser
address bar).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;There are some additional requirements that must be satisfied by a
controller action. A method used as a controller &lt;b&gt;action cannot be overloaded.&lt;/b&gt; Furthermore, a controller action
cannot be a &lt;b&gt;static&lt;/b&gt; method. Other
than that, you can use just about any method as a controller action.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; mso-margin-top-alt: auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;background: white; margin-bottom: .0001pt; margin: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;Understanding Action Results Types&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;background: white; margin-bottom: .0001pt; margin: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt; line-height: 21.45pt;&quot;&gt;A controller action returns something called an&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot; style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt; line-height: 21.45pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;i style=&quot;font-family: helvetica; font-size: 13.5pt; line-height: 21.45pt;&quot;&gt;action
result&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt; line-height: 21.45pt;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt; line-height: 21.45pt;&quot;&gt;An action result is what controller action returns in
response to a browser request.&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;The ASP.NET MVC framework supports several types of action results
including:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;1.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;ViewResult - Represents HTML and markup.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;2.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;EmptyResult - Represents no result.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;3.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;RedirectResult - Represents a redirection to a new URL.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;4.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;JsonResult - Represents a JavaScript Object Notation result that
can be used in an &lt;st1:city w:st=&quot;on&quot;&gt;&lt;st1:place w:st=&quot;on&quot;&gt;AJAX&lt;/st1:place&gt;&lt;/st1:city&gt;
application.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;5.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;JavaScriptResult - Represents a JavaScript script.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;6.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;ContentResult - Represents a text result.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;7.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;FileContentResult - Represents a downloadable file (with the
binary content).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;8.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;FilePathResult - Represents a downloadable file (with a path).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;9.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;FileStreamResult - Represents a downloadable file (with a file
stream).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;All of these action results inherit from the base ActionResult
class.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;In most cases, a controller action returns a ViewResult. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;For example, the Index controller action in Listing 2 returns a
ViewResult.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; margin-bottom: 0in;&quot;&gt;
&lt;div style=&quot;line-height: 21.45pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;Listing 2 - Controllers\BookController.cs&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Collections.Generic;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Linq;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Web;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Web.Mvc;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Web.Mvc.Ajax;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;namespace FirstMvcApplication1.Controllers&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; public class BookController : Controller&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // GET: /Book/&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult Index()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Add action logic here&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return View();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;When an action returns a ViewResult, HTML is returned to the
browser. The Index() method in Listing 2 returns a view named Index to the
browser.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;Notice that the Index() action in Listing 2 does not return a
ViewResult(). Instead, the View() method of the Controller base class is
called. Normally, you do not return an action result directly. Instead, you
call one of the following methods of the Controller base class:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;1.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;View - Returns a ViewResult action result.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;2.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;Redirect - Returns a RedirectResult action result.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;3.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;RedirectToAction - Returns a RedirectToRouteResult action result.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;4.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;RedirectToRoute - Returns a RedirectToRouteResult action result.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;5.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;Json - Returns a JsonResult action result.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;6.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;JavaScriptResult - Returns a JavaScriptResult.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;7.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;Content - Returns a ContentResult action result.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; margin-left: 31.8pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;8.&lt;span style=&quot;font-family: &amp;quot;times new roman&amp;quot;; font-size: 7pt; font-stretch: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;File - Returns a FileContentResult, FilePathResult, or
FileStreamResult depending on the parameters passed to the method.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;So, if you want to return a View to the browser, you call the
View() method. If you want to redirect the user from one controller action to
another, you call the RedirectToAction() method. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;For example&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;, the Details()
action in Listing 3 either displays a view or redirects the user to the Index()
action depending on whether the Id parameter has a value.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 21.45pt; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; margin-bottom: 0in;&quot;&gt;
&lt;div style=&quot;line-height: 21.45pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;Listing 3 - CourseController.cs&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 21.45pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Web.Mvc;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;namespace FirstMvcApplication1.Controllers&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; public class CourseController : Controller&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult Details(int? id)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!id.HasValue)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return RedirectToAction(&quot;Index&quot;);&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return View();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult Index()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return View();&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;The ContentResult action result is special. You can use the
ContentResult action result to return an action result as plain text. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;For example, the Index() method in Listing 4 returns a message as
plain text and not as HTML.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; margin-bottom: 0in;&quot;&gt;
&lt;div style=&quot;line-height: 21.45pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;Listing 4 - Controllers\StatusController.cs&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;using System.Web.Mvc;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;namespace FirstMvcApplication1.Controllers&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; public class StatusController : Controller&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // GET: /Status/&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult Index()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return Content(&quot;Hello World!&quot;);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 28.6px;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;When the StatusController.Index() action is invoked, a view is not
returned. Instead, the raw text &quot;Hello World!&quot; is returned to the
browser.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;If a controller action returns a result that is not an action
result - for example, a date or an integer - then the result is wrapped in a
ContentResult automatically. For example, when the Index() action of the
WorkController in Listing 5 is invoked, the date is returned as a ContentResult
automatically.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background: white; margin-bottom: 0in;&quot;&gt;
&lt;div style=&quot;line-height: 21.45pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;Listing 5 - WorkController.cs&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;using System.Web.Mvc;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;namespace FirstMvcApplication1.Controllers&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; public class WorkController : Controller&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // GET: /Work/&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public DateTime Index()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return DateTime.Now;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;helvetica&amp;quot;;&quot;&gt;&lt;span style=&quot;font-size: 18px; line-height: 28.6px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;x-hidden-focus&quot; style=&quot;background: white; line-height: 21.45pt; margin-bottom: .0001pt; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;helvetica&amp;quot;; font-size: 13.5pt;&quot;&gt;The Index() action in Listing 5 returns a DateTime object.
The ASP.NET MVC framework converts the DateTime object to a string and wraps
the DateTime value in a ContentResult automatically. The browser receives the
date and time as plain text.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/322936297975942071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/action-methods-in-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/322936297975942071'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/322936297975942071'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/action-methods-in-mvc.html' title='Action methods in mvc'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6-hVxG6xDsxdtKch9YKaEj6BXQrE0OcV2Ww1Ubnwpvi2GpqWV24cGgab_rTWhipZbj6fhg6l6cDXAl3kMLqlk8m0BI35btmxsZkhequUuYR-L-HkKmC3YRmD1laFh8N-Pe2ml8HZrqHIW/s72-c/controller-action-methods-in-mvc.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-2537289379372088462</id><published>2019-03-20T13:12:00.001+05:30</published><updated>2019-04-26T20:09:19.806+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Controller"/><title type='text'>how to create controller in mvc</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;margin-bottom: 2.4pt; margin-left: 0in; margin-right: 2.4pt; margin-top: 2.4pt; mso-line-height-alt: 18.0pt;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: 19px; line-height: 18pt; text-align: justify;&quot;&gt;To remove the 404 Not Found error, we need to add a controller,
which handles all the incoming requests.&lt;/span&gt;&lt;/h2&gt;
&lt;h3 style=&quot;background-color: white; line-height: 1.4;&quot;&gt;

&lt;div style=&quot;line-height: 18pt; margin: 0in 2.4pt 0.1in; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: large; font-weight: normal;&quot;&gt;Step 1&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 19px;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;− To add a controller, right-click on
the controller folder in the &lt;/span&gt;solution explorer and select&lt;span style=&quot;font-weight: normal;&quot;&gt; &lt;/span&gt;Add &lt;/span&gt;&lt;span style=&quot;font-size: 19px;&quot;&gt;→&lt;/span&gt;&lt;span style=&quot;font-size: 19px;&quot;&gt; Controller&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 19px;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/h3&gt;
&lt;h2 style=&quot;margin-bottom: 2.4pt; margin-left: 0in; margin-right: 2.4pt; margin-top: 2.4pt; mso-line-height-alt: 18.0pt;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMPNa8BvQA_GUn4NOAs7ejNUpR3pe92D3lamxgkYCUo6x-0_GP-seniGCJ4ItiHZQDJBgdaiP_WIlvvDvM3wZsEm6_q5D8XNxl4jsfLcLctL_cmE_Ubwu9aNgo2JiigECICDX2NMb9m95A/s1600/AddController.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img alt=&quot;how to create controller in mvc&quot; border=&quot;0&quot; data-original-height=&quot;720&quot; data-original-width=&quot;720&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMPNa8BvQA_GUn4NOAs7ejNUpR3pe92D3lamxgkYCUo6x-0_GP-seniGCJ4ItiHZQDJBgdaiP_WIlvvDvM3wZsEm6_q5D8XNxl4jsfLcLctL_cmE_Ubwu9aNgo2JiigECICDX2NMb9m95A/s1600/AddController.jpg&quot; title=&quot;how to create controller in mvc&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-size: large; font-weight: normal; line-height: 24px; text-align: justify;&quot;&gt;Step 2&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-weight: normal; line-height: 24px; text-align: justify;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-weight: normal; line-height: 18pt; text-align: justify;&quot;&gt;− &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;Select the MVC 5 Controller – &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt;&quot;&gt;Empty
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;option and click ‘Add’ button.&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;margin-bottom: 2.4pt; margin-left: 0in; margin-right: 2.4pt; margin-top: 2.4pt; mso-line-height-alt: 18.0pt;&quot;&gt;

&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;The Add Controller dialog will appear&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;margin-bottom: 2.4pt; margin-left: 0in; margin-right: 2.4pt; margin-top: 2.4pt; mso-line-height-alt: 18.0pt;&quot;&gt;
&lt;br /&gt;&lt;div style=&quot;line-height: 18.0pt; margin-bottom: .1in; margin-left: 2.4pt; margin-right: 2.4pt; margin-top: 0in; text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihngiTjw0LqVPU1fUG0ZA-UYaIbPfojYwSAaggjTuxvhUUSTYJNPLDnzi8MM9rCY-D5skWj7rMz6BO7ssl3VGhNzgZzcFtPDtOQtww0HKxXkGNt0Jh1x14Qve2R5YdDVyRusDlpFdzhwgi/s1600/ControllerSelect.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img alt=&quot;how to create controller in mvc&quot; border=&quot;0&quot; data-original-height=&quot;385&quot; data-original-width=&quot;700&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihngiTjw0LqVPU1fUG0ZA-UYaIbPfojYwSAaggjTuxvhUUSTYJNPLDnzi8MM9rCY-D5skWj7rMz6BO7ssl3VGhNzgZzcFtPDtOQtww0HKxXkGNt0Jh1x14Qve2R5YdDVyRusDlpFdzhwgi/s1600/ControllerSelect.jpg&quot; title=&quot;how to create controller in mvc&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVifoWGv9Zn7R-0n7Di-W3I87ij5K0lKP1xSClatwfeAWY-bv986jnn6Xztf7sU3bf-V7oyEXnwRBIxvNtf43iNhtnRnfV8yzw9Kv66Ni7a79Ct21diSwNg_GEtTwXKYQwgoJbsA46Ta5y/s1600/ControllerSelect.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #111111; font-size: 14px; font-weight: normal; line-height: 1.4;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #111111; font-size: 14px; font-weight: normal; line-height: 1.4;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/h2&gt;
&lt;h2 style=&quot;margin: 2.4pt 2.4pt 2.4pt 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-size: large; font-weight: normal; line-height: 24px; text-align: justify;&quot;&gt;Step 3&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: small; font-weight: normal; line-height: 18pt; text-align: justify;&quot;&gt;−&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;Set the name to &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt;&quot;&gt;FirstMVCController &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;and click the Add button.&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;line-height: 18.0pt; margin-bottom: .1in; margin-left: 2.4pt; margin-right: 4.8pt; margin-top: 0in; mso-outline-level: 3; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt;&quot;&gt;You will see a new C#
file &lt;b&gt;FirstMVCController.cs &lt;/b&gt;in the Controllers folder, which is open for editing
in Visual Studio as well&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;.&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 18pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;h2 style=&quot;margin-bottom: 2.4pt; margin-left: 0in; margin-right: 2.4pt; margin-top: 2.4pt; mso-line-height-alt: 18.0pt;&quot;&gt;
&lt;div style=&quot;line-height: 18.0pt; margin-bottom: .1in; margin-left: 2.4pt; margin-right: 2.4pt; margin-top: 0in; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEaHBnJgU0uhp85hv5kOGTNapKj30FErQdN3hAmwuzFFgWgK0I9yl7YEUdEEf8SgOB3ViK25R53hB7as-vuT2lHSTmPQMWUBrz4oOY4xwUw2zUrGXInl_QWB96AnOu2S_Oj1DESVqlOOxv/s1600/ChangeNameController.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;img alt=&quot;how to create controller in mvc&quot; border=&quot;0&quot; data-original-height=&quot;187&quot; data-original-width=&quot;628&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEaHBnJgU0uhp85hv5kOGTNapKj30FErQdN3hAmwuzFFgWgK0I9yl7YEUdEEf8SgOB3ViK25R53hB7as-vuT2lHSTmPQMWUBrz4oOY4xwUw2zUrGXInl_QWB96AnOu2S_Oj1DESVqlOOxv/s1600/ChangeNameController.JPG&quot; title=&quot;how to create controller in mvc&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #111111; font-size: 14px; font-weight: normal; line-height: 1.4;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/h2&gt;
&lt;h2 style=&quot;margin: 2.4pt 2.4pt 2.4pt 0in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-size: large; font-weight: normal; line-height: 24px; text-align: justify;&quot;&gt;Step 4&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: small; font-weight: normal; line-height: 18pt; text-align: justify;&quot;&gt;−&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;To make this a working example, let’s modify the &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt;&quot;&gt;controller class &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;by
changing the &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt;&quot;&gt;action method&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt; called&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot; style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;Index&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot; style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;using the following code.&amp;nbsp;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;margin: 2.4pt 2.4pt 2.4pt 0in;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot;; font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;public class FirstMVCController : Controller &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;{ &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot;; font-weight: normal;&quot;&gt;&amp;nbsp;// &amp;nbsp;GET: &amp;nbsp; &amp;nbsp;FirstMVC &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public string Index() { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return &quot;Hello World, this is ASP.Net MVC Tutorials&quot;; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp; &amp;nbsp;} &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot;;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;font-family: verdana;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;margin: 2.4pt 0in 2.4pt 2.4pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-size: large; font-weight: normal; line-height: 24px; text-align: justify;&quot;&gt;Step 5&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-size: 19px; font-weight: normal; line-height: 18pt; text-align: justify;&quot;&gt;−&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt;&quot;&gt;Run this application &lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;and you will &lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt;&quot;&gt;see &lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;that the &lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt;&quot;&gt;browser&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot;; font-size: 14pt; font-weight: normal;&quot;&gt;
is displaying the result of the Index action method&lt;/span&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;!--[endif]--&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/2537289379372088462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/how-to-create-controller-in-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/2537289379372088462'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/2537289379372088462'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/how-to-create-controller-in-mvc.html' title='how to create controller in mvc'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMPNa8BvQA_GUn4NOAs7ejNUpR3pe92D3lamxgkYCUo6x-0_GP-seniGCJ4ItiHZQDJBgdaiP_WIlvvDvM3wZsEm6_q5D8XNxl4jsfLcLctL_cmE_Ubwu9aNgo2JiigECICDX2NMb9m95A/s72-c/AddController.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-1178212508156017598</id><published>2019-03-19T17:19:00.000+05:30</published><updated>2019-04-26T20:23:07.171+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Routing in mvc"/><title type='text'>Routing in mvc</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;firstpara&quot; style=&quot;background-color: #fcfcfc; box-sizing: border-box; color: #161616; font-size: 16px; line-height: 22px; padding: 10px 0px; text-align: justify; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Basically, &lt;b&gt;Routing in mvc&lt;/b&gt; is a pattern matching system that monitor the incoming request and figure out what to do with that request. At runtime, Routing engine use the Route table for matching the incoming request&#39;s URL pattern against the URL patterns defined in the Route table. You can register one or more URL patterns to the Route table at Application_Start event. MVC5 also supports attribute routing&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;background-color: #fcfcfc; box-sizing: border-box; line-height: 1.2; margin: 20px 0px 15px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: large;&quot;&gt;How to define Routing in mvc ..&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;background-color: #fcfcfc; box-sizing: border-box; font-size: 30px; line-height: 1.2; margin: 20px 0px 15px; padding: 0px; text-align: justify;&quot;&gt;
&lt;ol class=&quot;linenums&quot; style=&quot;box-sizing: border-box; color: #9d9d9d; font-family: monospace; font-size: 13px; font-weight: normal; line-height: 18.5714px; list-style-type: decimal-leading-zero; margin: 0px; padding: 0px; white-space: pre-wrap;&quot;&gt;
&lt;li class=&quot;L0&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: blue; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: blue; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: blue; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #0088cc; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;RegisterRoutes&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #0088cc; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;RouteCollection&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; routes&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L1&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L2&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;  routes&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #0088cc; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;MapRoute&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L3&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #ea172b; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;&quot;Default&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #006600; font-style: italic; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;// Route name&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L4&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #ea172b; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;&quot;{controller}/{action}/{id}&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #006600; font-style: italic; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;// Route Pattern&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L5&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: blue; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; controller &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #ea172b; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;&quot;Home&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; action &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #ea172b; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;&quot;Index&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; id &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #0088cc; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;UrlParameter&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #0088cc; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;Optional&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #006600; font-style: italic; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;// Default values for above defined parameters&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L6&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L7&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;} &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L9&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: blue; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: blue; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #0088cc; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;Application_Start&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;() &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L0&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L1&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #0088cc; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;RegisterRoutes&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #0088cc; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;RouteTable&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #0088cc; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;Routes&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;); &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L2&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box; color: black; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #006600; font-style: italic; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;//To:DO &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;L3&quot; style=&quot;box-sizing: border-box; color: #3c3c3c; font-size: 15px; list-style-type: none; margin: 0px 0px 0px 12px; padding: 1px 0px;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600; margin: 0px; padding: 0px; vertical-align: top;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;} &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/h2&gt;
&lt;h2 style=&quot;background-color: #fcfcfc; box-sizing: border-box; font-size: 30px; line-height: 1.2; margin: 20px 0px 15px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #161616; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-size: 16px; font-weight: normal; line-height: 22px; white-space: pre-wrap;&quot;&gt;When the routing engine finds a match in the route table for the incoming request&#39;s URL, it forwards the request to the appropriate controller and action. If there is no match in the route table for the incoming request&#39;s URL, it returns a 404 HTTP status code.&lt;/span&gt;&lt;/h2&gt;
&lt;h4 style=&quot;background-color: #fcfcfc; box-sizing: border-box; font-size: 24px; line-height: 1.2; margin: 20px 0px 15px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-weight: normal;&quot;&gt;Note&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;note&quot; style=&quot;background-color: #f3f3f3; border-left-color: rgb(0, 150, 136); border-left-style: solid; border-left-width: 2px; box-sizing: border-box; color: #161616; font-size: 16px; line-height: 22px; padding: 4px 6px 4px 8px; vertical-align: top;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Always remember route name should be unique across the entire application. Route name can’t be duplicate.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #fcfcfc; box-sizing: border-box; line-height: 1.2; margin: 20px 0px 15px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;How it works&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot; , sans-serif; line-height: 1.2;&quot;&gt;Routing&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot; , sans-serif; line-height: 1.2;&quot;&gt;..&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;verdana&amp;quot; , sans-serif; font-weight: 500; line-height: 1.2;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjagiNVo6YoFJ2sdee4iOubnR6VapcrKr_wsN4ZPbR2PoAH2KeLryj7aeoCOseFLRKBFfwAICRm9_NNgR9n9r3Q-tDApQ-Gnc6Ir6CQboARXS3XyQzlhvGZuzbV3cS8Nn21nrD_4X7Gtqks/s1600/incoming-request-processing-by-routing+system.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;img alt=&quot;Routing in mvc&quot; border=&quot;0&quot; data-original-height=&quot;470&quot; data-original-width=&quot;517&quot; height=&quot;362&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjagiNVo6YoFJ2sdee4iOubnR6VapcrKr_wsN4ZPbR2PoAH2KeLryj7aeoCOseFLRKBFfwAICRm9_NNgR9n9r3Q-tDApQ-Gnc6Ir6CQboARXS3XyQzlhvGZuzbV3cS8Nn21nrD_4X7Gtqks/s400/incoming-request-processing-by-routing+system.JPG&quot; title=&quot;Routing in mvc&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;center&quot; style=&quot;background-color: #fcfcfc; box-sizing: border-box; color: #161616; font-size: 16px; line-height: 22px; margin: 0px; padding: 0px; text-align: center; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #fcfcfc; box-sizing: border-box; color: #161616; font-size: 16px; line-height: 22px; padding: 10px 0px; text-align: justify; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;In above example we have defined the Route Pattern {controller}/{action}/{id} and also provide the default values for controller,action and id parameters. Default values means if you will not provide the values for controller or action or id defined in the pattern then these values will be serve by the routing system.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #fcfcfc; box-sizing: border-box; color: #161616; font-size: 16px; line-height: 22px; padding: 10px 0px; text-align: justify; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Suppose your webapplication is running on www.example.com then the url pattren for you application will be www.example.com/{controller}/{action}/{id}. Hence you need to provide the controller name followed by action name and id if it is required. If you will not provide any of the value then default values of these parameters will be provided by the routing system. Here is a list of URLs that match and don&#39;t match this route pattern.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;table&quot; style=&quot;background-color: #fcfcfc; border-collapse: collapse; box-sizing: border-box; color: #161616; display: table; font-size: 16px; line-height: 22px; margin: 1em 0px 1em 1em; padding: 0px; text-align: justify; vertical-align: top; width: 545px;&quot;&gt;
&lt;div class=&quot;caption&quot; style=&quot;box-sizing: border-box; display: table-caption; margin: 0px; padding: 0px; text-align: center; vertical-align: top; width: 545px;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Matching URLs&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;table&quot; style=&quot;background-color: #fcfcfc; border-collapse: collapse; box-sizing: border-box; color: #161616; display: table; font-size: 16px; line-height: 22px; margin: 1em 0px 1em 1em; padding: 0px; text-align: justify; vertical-align: top; width: 545px;&quot;&gt;
&lt;div class=&quot;headrow&quot; style=&quot;background: rgb(238, 238, 238); box-sizing: border-box; color: #272727; display: table-row; margin: 0px; padding: 0px; text-shadow: rgb(255, 255, 255) 1px 1px 0px; vertical-align: top; width: 544px;&quot;&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top; width: 371px;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Request URL&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Parameters&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;divrow&quot; style=&quot;box-sizing: border-box; display: table-row; margin: 0px; padding: 0px; vertical-align: top; width: 544px;&quot;&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;http://example.com/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;controller=Home, action=Index, id=none, Since default value of controller and action are Home and Index respectively.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;divrow&quot; style=&quot;box-sizing: border-box; display: table-row; margin: 0px; padding: 0px; vertical-align: top; width: 544px;&quot;&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;http://example.com/Admin&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;controller=Admin, action=Index, id=none, Since default value of action is Index&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;divrow&quot; style=&quot;box-sizing: border-box; display: table-row; margin: 0px; padding: 0px; vertical-align: top; width: 544px;&quot;&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;http://example.com/Admin/Product&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;controller=Admin, action=Product, id=none&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;divrow&quot; style=&quot;box-sizing: border-box; display: table-row; margin: 0px; padding: 0px; vertical-align: top; width: 544px;&quot;&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;http://example.com/Admin/Product/1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;controller=Admin, action=Product, id=1&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;divrow&quot; style=&quot;box-sizing: border-box; display: table-row; margin: 0px; padding: 0px; vertical-align: top; width: 544px;&quot;&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;http://example.com/Admin/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Product/SubAdmin/1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;No Match Found&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;divrow&quot; style=&quot;box-sizing: border-box; display: table-row; margin: 0px; padding: 0px; vertical-align: top; width: 544px;&quot;&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;http://example.com/Admin/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Product/SubAdmin/Add/1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 1px solid rgb(196, 196, 196); box-sizing: border-box; display: table-cell; margin: 0px; padding: 5px; text-align: left; vertical-align: top;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;No Match Found&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/1178212508156017598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/Routinginmvc.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/1178212508156017598'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/1178212508156017598'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/Routinginmvc.html' title='Routing in mvc'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjagiNVo6YoFJ2sdee4iOubnR6VapcrKr_wsN4ZPbR2PoAH2KeLryj7aeoCOseFLRKBFfwAICRm9_NNgR9n9r3Q-tDApQ-Gnc6Ir6CQboARXS3XyQzlhvGZuzbV3cS8Nn21nrD_4X7Gtqks/s72-c/incoming-request-processing-by-routing+system.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-7092853416067148248</id><published>2019-03-18T22:54:00.000+05:30</published><updated>2019-04-26T20:26:01.790+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mvc Life Cycle"/><title type='text'>Mvc life cycle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; orphans: auto; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
In this chapter, we will discuss the overall MVC pipeline and the life of an HTTP request as it travels through the MVC framework in ASP.NET. At a high level, a life cycle is simply a series of steps or events used to handle some type of request or to change an application state. You may already be familiar with various framework life cycles, the concept is not unique to MVC.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; orphans: auto; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
For example, the ASP.NET webforms platform features a complex page life cycle. Other .NET platforms, like Windows phone apps, have their own application life cycles. One thing that is true for all these platforms regardless of the technology is that understanding the processing pipeline can help you better leverage the features available and MVC is no different.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-family: Verdana,Geneva,Tahoma,Arial,Helvetica,sans-serif; font-size: 15px ! important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; overflow-wrap: break-word; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;b&gt;MVC has two life cycles&lt;/b&gt; &lt;b&gt;:&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;The application life cycle&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;The request life cycle&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_PZRfxLqDJxD0C9D0gCAhLSZNc_Spbb_IuWDgwomI4Z2agr8N0M3vZaRLzR11lWjcyzd1fik2I2g-dEfI5EReejSwKTxDqkQW35RP2vkoQt2k6kkbWynAQ8lR7kQ3O9WK1KrwXmFF2weh/s1600/asp.net+mvc+Life+Cycle.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Mvc life cycle&quot; border=&quot;0&quot; data-original-height=&quot;216&quot; data-original-width=&quot;600&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_PZRfxLqDJxD0C9D0gCAhLSZNc_Spbb_IuWDgwomI4Z2agr8N0M3vZaRLzR11lWjcyzd1fik2I2g-dEfI5EReejSwKTxDqkQW35RP2vkoQt2k6kkbWynAQ8lR7kQ3O9WK1KrwXmFF2weh/s640/asp.net+mvc+Life+Cycle.jpg&quot; title=&quot;Mvc life cycle&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;h2 style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: #121214; font-size: 1.7em; font-style: normal; font-variant: normal; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-align: start; text-indent: 0px; text-shadow: 1px 1px 2px rgb(204, 204, 204); text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The Application Life Cycle&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-size: 15px ! important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; overflow-wrap: break-word; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The application life cycle refers to the time at which the application process actually begins running IIS until the time it stops. This is marked by the application start and end events in the startup file of your application.&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: #121214; font-size: 1.7em; font-style: normal; font-variant: normal; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-align: start; text-indent: 0px; text-shadow: 1px 1px 2px rgb(204, 204, 204); text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The Request Life Cycle&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-size: 15px ! important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; overflow-wrap: break-word; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;It is the sequence of events that happen every time an HTTP request is handled by our application.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-size: 15px ! important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; overflow-wrap: break-word; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The entry point for every MVC application begins with routing. After the ASP.NET platform has received a request, it figures out how it should be handled through the URL Routing Module.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-size: 15px ! important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; overflow-wrap: break-word; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;Modules are .NET components that can hook into the application life cycle and add functionality. The routing module is responsible for matching the incoming URL to routes that we define in our application.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-size: 15px ! important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; overflow-wrap: break-word; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;All routes have an associated route handler with them and this is the entry point to the MVC framework.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1BLtGE7Crh3c2X6mJorXpNYx3VydG-OCYa2KkgVmHQQEKm2qZHXSLVZTXcpzedzevbU2HepMBCfatK7s3__RzsZwVpmIVq88diJGnQob7ebWOvBo9tHOnyTd1q0xo8sxYenSTAadMmamN/s1600/Life+Cycle.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Mvc life cycle&quot; border=&quot;0&quot; data-original-height=&quot;551&quot; data-original-width=&quot;368&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1BLtGE7Crh3c2X6mJorXpNYx3VydG-OCYa2KkgVmHQQEKm2qZHXSLVZTXcpzedzevbU2HepMBCfatK7s3__RzsZwVpmIVq88diJGnQob7ebWOvBo9tHOnyTd1q0xo8sxYenSTAadMmamN/s640/Life+Cycle.png&quot; title=&quot;Mvc life cycle&quot; width=&quot;426&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; orphans: auto; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; orphans: auto; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
The MVC framework handles converting the route data into a concrete controller that can handle requests. After the controller has been created, the next major step is&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Action Execution&lt;/b&gt;. A component called the&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;action invoker&lt;/b&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;finds and selects an appropriate Action method to invoke the controller.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; orphans: auto; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
After our action result has been prepared, the next stage triggers, which is&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Result Execution&lt;/b&gt;. MVC separates declaring the result from executing the result. If the result is a view type, the View Engine will be called and it&#39;s responsible for finding and rending our view.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; orphans: auto; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
If the result is not a view, the action result will execute on its own. This Result Execution is what generates an actual response to the original HTTP request.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; box-sizing: border-box; color: black; font-family: Verdana, Geneva, Tahoma, Arial, Helvetica, sans-serif; font-size: 15px !important; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0em 0.2em 0.6em; orphans: auto; padding: 0px; text-align: justify; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/7092853416067148248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/MvcLifeCycle.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/7092853416067148248'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/7092853416067148248'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/MvcLifeCycle.html' title='Mvc life cycle'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_PZRfxLqDJxD0C9D0gCAhLSZNc_Spbb_IuWDgwomI4Z2agr8N0M3vZaRLzR11lWjcyzd1fik2I2g-dEfI5EReejSwKTxDqkQW35RP2vkoQt2k6kkbWynAQ8lR7kQ3O9WK1KrwXmFF2weh/s72-c/asp.net+mvc+Life+Cycle.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3623174770832603697.post-6050848038003971143</id><published>2019-03-15T14:00:00.002+05:30</published><updated>2019-04-26T20:36:10.773+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MVC Introduction"/><title type='text'>MVC Introduction</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;background-color: white; box-sizing: border-box; font-size: 2.2em; letter-spacing: -1px; line-height: 1.1; margin: 0.2em 0.2em 1em 0px; padding: 0px; text-align: left; text-shadow: 2px 2px 3px rgb(229, 239, 245);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Entity Framework Code-First&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: #494949; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Learn
 Entity Framework Code-First in simple step-by-step tutorials. These 
tutorials cover all the features of Entity Framework Code-First starting
 with the basics of code-first, DB migration, configuring one-to-one, 
one-to-many and many-to-many relationships with DataAnnotation &amp;amp;
 Fluent API, and many other features.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: #494949; font-size: 15px; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 1.5em; letter-spacing: -1px;&quot;&gt;Audience&lt;/span&gt;&lt;span style=&quot;font-size: 1.5em; letter-spacing: -1px;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #494949;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;This tutorial is helpful for beginners who want to learn the Entity Framework Code-First approach from scratch.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #494949;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #38761d; font-size: 1.5em; letter-spacing: -1px; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 1.5em; letter-spacing: -1px; text-align: left;&quot;&gt;Prerequisites&lt;/span&gt;&lt;span style=&quot;font-size: 1.5em; letter-spacing: -1px; text-align: left;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #494949;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Basic
 knowledge of .Net Framework, C#, Visual Studio, and MS SQL Server are 
required. Also, basic knowledge of Entity Framework would be 
advantageous.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #494949;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h1 style=&quot;box-sizing: border-box; font-size: 2.2em; letter-spacing: -1px; line-height: 1.1; margin: 0.2em 0.2em 1em 0px; padding: 0px; text-align: left; text-shadow: rgb(229, 239, 245) 2px 2px 3px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif; font-size: large;&quot;&gt;ASP.NET MVC Folder Structure:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div style=&quot;color: #494949;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;We
 have created our first MVC 5 application in the previous section. 
Visual Studio creates the following folder structure for MVC application
 by default.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #494949;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , &amp;quot;tahoma&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #494949; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGt-Hp7KYe-fboXlSnwopeHLb1Nu0wRETVbOFB9kMxtP7I37BdBjvFUqOoHMMsVXEmVrFHwIVJbgb9jfXOixAgQlxjbg79EsxAywYK6nkXNFg84EeU4wJirZzNzhcN81kXxaOEQTFXHOUD/s1600/mvc-folder-structure.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;MVC Introduction&quot; border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGt-Hp7KYe-fboXlSnwopeHLb1Nu0wRETVbOFB9kMxtP7I37BdBjvFUqOoHMMsVXEmVrFHwIVJbgb9jfXOixAgQlxjbg79EsxAywYK6nkXNFg84EeU4wJirZzNzhcN81kXxaOEQTFXHOUD/s400/mvc-folder-structure.png&quot; title=&quot;MVC Introduction&quot; width=&quot;357&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #494949; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;b&gt;Let&#39;s see significance of each folder.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; font-weight: normal; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;App_Data:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;App_Data
 folder can contain application data files like LocalDB, .mdf files, xml
 files and other data related files. IIS will never serve files from 
App_Data folder.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; font-weight: normal; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;App_Start&lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;App_Start
 folder can contain class files which will be executed when the 
application starts. Typically, these would be config files like 
AuthConfig.cs, BundleConfig.cs, FilterConfig.cs, RouteConfig.cs etc. MVC
 5 includes BundleConfig.cs, FilterConfig.cs and RouteConfig.cs by 
default. We will see significance of these files later.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI9R7m0smw-m3bSVLO5-WGml5m0es9WCWFTp6huOUAmNIl7eVBMRt9RWiKeRyD3Uj-CYx4sFW3oXSbPLs5SIHZDVVh5XzFek6IGiKyM34uWURxlXHlkEXBOtidrq4Xx8dy1BQetb3mqoYA/s1600/appstart.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;MVC Introduction&quot; border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI9R7m0smw-m3bSVLO5-WGml5m0es9WCWFTp6huOUAmNIl7eVBMRt9RWiKeRyD3Uj-CYx4sFW3oXSbPLs5SIHZDVVh5XzFek6IGiKyM34uWURxlXHlkEXBOtidrq4Xx8dy1BQetb3mqoYA/s400/appstart.png&quot; title=&quot;MVC Introduction&quot; width=&quot;271&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; font-weight: normal; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;color: #486a80;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Content
 folder contains static files like css files, images and icons files. 
MVC 5 application includes bootstrap.css, bootstrap.min.css and Site.css
 by default.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJGDhJfUy0GASYwxUIkBFMLOFch7v_fNdIusTry4tVxPmg09uhSdaTDLnSilJ10Zgpdp7FjXwcAtgvlkZsMhCuBBi_j3bLuQZzQGqfMITJpZHv0tqEmwlq8dHdtkis7HU3ZV58AuuzTnB-/s1600/content-folder.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;MVC Introduction&quot; border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJGDhJfUy0GASYwxUIkBFMLOFch7v_fNdIusTry4tVxPmg09uhSdaTDLnSilJ10Zgpdp7FjXwcAtgvlkZsMhCuBBi_j3bLuQZzQGqfMITJpZHv0tqEmwlq8dHdtkis7HU3ZV58AuuzTnB-/s400/content-folder.png&quot; title=&quot;MVC Introduction&quot; width=&quot;292&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; font-weight: normal; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Controllers:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Controllers
 folder contains class files for the controllers. Controllers handles 
users&#39; request and returns a response. MVC requires the name of all 
controller files to end with &quot;Controller&quot;. You will learn about the 
controller in the next section.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3IFKHJRyGFn_ZdWqqghjKhyphenhyphenWiIbkPC02U_gYRqNhhDPDulPK-AK6KPg5m29nHWBPm_g-OFwVI0B2IT1FZaM5Nft90aBnhkkvM2xF2_wPmMFt18JhIdUFcd_vEwf4MDJ4JUg3rstS5o_Td/s1600/controller-folder.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;MVC Introduction&quot; border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3IFKHJRyGFn_ZdWqqghjKhyphenhyphenWiIbkPC02U_gYRqNhhDPDulPK-AK6KPg5m29nHWBPm_g-OFwVI0B2IT1FZaM5Nft90aBnhkkvM2xF2_wPmMFt18JhIdUFcd_vEwf4MDJ4JUg3rstS5o_Td/s400/controller-folder.png&quot; title=&quot;MVC Introduction&quot; width=&quot;322&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;fonts:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Fonts folder contains custom font files for your application.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCcvyK0uY5QHAzjvV5JVa7THxeufHAfQQo_Hb6M17aB6fl-RQBG_AOtAy-LKaPLONkzT-NPJpPAASJN1ltnZS1hrXM3QjUHw7Sic5lchLz3NPCei8bdLmZynRIf5L7nEMJOneIjhEPII28/s1600/fonts-folder.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;MVC Introduction&quot; border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCcvyK0uY5QHAzjvV5JVa7THxeufHAfQQo_Hb6M17aB6fl-RQBG_AOtAy-LKaPLONkzT-NPJpPAASJN1ltnZS1hrXM3QjUHw7Sic5lchLz3NPCei8bdLmZynRIf5L7nEMJOneIjhEPII28/s400/fonts-folder.png&quot; title=&quot;MVC Introduction&quot; width=&quot;276&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; font-weight: normal; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Models:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Models
 folder contains model class files. Typically model class includes 
public properties, which will be used by application to hold and 
manipulate application data.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; font-weight: normal; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Scripts:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Scripts
 folder contains JavaScript or VBScript files for the application. MVC 5
 includes javascript files for bootstrap, jquery 1.10 and modernizer by 
default.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHrCiLnIDptQqnmg0gsXhszDPL2o_U9zzwN27RID0wafJYadx6rKApXV09fVU6rXmVx7iGmLKy8PXZua9zMmlcwP21M196hUXtbX482ih_tqr6Iy9aT2vsBXwNpAR9MLZHI2_yj4DiP7mX/s1600/scripts-folder.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;MVC Introduction&quot; border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHrCiLnIDptQqnmg0gsXhszDPL2o_U9zzwN27RID0wafJYadx6rKApXV09fVU6rXmVx7iGmLKy8PXZua9zMmlcwP21M196hUXtbX482ih_tqr6Iy9aT2vsBXwNpAR9MLZHI2_yj4DiP7mX/s400/scripts-folder.png&quot; title=&quot;MVC Introduction&quot; width=&quot;201&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; font-weight: normal; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Views:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Views
 folder contains html files for the application. Typically view file is a
 .cshtml file where you write html and C# or VB.NET code.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Views
 folder includes separate folder for each controllers. For example, all 
the .cshtml files, which will be rendered by HomeController will be in 
View &amp;gt; Home folder.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Shared folder under View folder contains all the views which will be shared among different controllers e.g. layout files.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfmXnadBobVntV1ukK13scOooHZokX0RwEastoPZGwwnXtIKXw39Tr91S9ecVg29cQoLFmE3w5Xwkd78M3eLGNKHzXgjohThq5AZ87SGJERVMTVC6M5j5juV-IQ2H_Gffux33CapoCvhdl/s1600/view-folder.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;MVC Introduction&quot; border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfmXnadBobVntV1ukK13scOooHZokX0RwEastoPZGwwnXtIKXw39Tr91S9ecVg29cQoLFmE3w5Xwkd78M3eLGNKHzXgjohThq5AZ87SGJERVMTVC6M5j5juV-IQ2H_Gffux33CapoCvhdl/s400/view-folder.png&quot; title=&quot;MVC Introduction&quot; width=&quot;216&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Additionally, MVC project also includes following configuration files:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; font-weight: normal; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #93c47d; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Global.asax:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Global.asax
 allows you to write code that runs in response to application level 
events, such as Application_BeginRequest, application_start, 
application_error, session_start, session_end etc.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; font-weight: normal; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Packages.config:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Packages.config file is managed by NuGet to keep track of what packages and versions you have installed in the application.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;box-sizing: border-box; font-size: 1.8em; font-weight: normal; letter-spacing: -1px; line-height: 1.5em; margin: 1.2em 0.2em 0.6em 0px; padding: 0px; text-align: start; text-shadow: rgb(229, 239, 245) 1px 1px 2px;&quot;&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #6aa84f; font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Web.config:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Web.config file contains application level configurations.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494949; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;The
 MVC (Model-View-Controller) design pattern has actually been around for
 a few decades, and it&#39;s been used across many different technologies. 
Everything from Smalltalk to C++ to Java, and now C Sharp and .NET use 
this design pattern to build a user interface.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Following are some salient features of the MVC pattern −&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; text-align: left;&quot;&gt;
&lt;li style=&quot;background-position: 0px 4px; background-repeat: no-repeat; box-sizing: border-box; color: black; line-height: 24px; list-style: outside none none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Originally it was named Thing-Model-View-Editor in 1979, and then it was later simplified to Model- View-Controller.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;background-position: 0px 4px; background-repeat: no-repeat; box-sizing: border-box; color: black; line-height: 24px; list-style: outside none none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;It
 is a powerful and elegant means of separating concerns within an 
application (for example, separating data access logic from display 
logic) and applies itself extremely well to web applications.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;background-position: 0px 4px; background-repeat: no-repeat; box-sizing: border-box; color: black; line-height: 24px; list-style: outside none none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Its
 explicit separation of concerns does add a small amount of extra 
complexity to an application’s design, but the extraordinary benefits 
outweigh the extra effort.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;The MVC architectural pattern separates the user interface (UI) of an application into three main parts&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: black; font-size: medium; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiarW5Km8q4iuV-qo6KXv1tIUyE6gafYZAeVOk2zzwTObeYskKnoLyVLppc5-SSlB5jj5bZIcFagVfnm0COp59XA8hO7WMGiwD6FUAoVy1BGAy3mrD3FLdtUalGNdzXsP6KGDekWEzrzcJM/s1600/what-is-aspdotnet-mvc-1.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;MVC Introduction&quot; border=&quot;0&quot; height=&quot;297&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiarW5Km8q4iuV-qo6KXv1tIUyE6gafYZAeVOk2zzwTObeYskKnoLyVLppc5-SSlB5jj5bZIcFagVfnm0COp59XA8hO7WMGiwD6FUAoVy1BGAy3mrD3FLdtUalGNdzXsP6KGDekWEzrzcJM/s320/what-is-aspdotnet-mvc-1.png&quot; title=&quot;MVC Introduction&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-size: 14px; text-align: left;&quot;&gt;
&lt;li style=&quot;background-position: 0px 4px; background-repeat: no-repeat; box-sizing: border-box; color: black; line-height: 24px; list-style: outside none none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;The Model&lt;/b&gt;&amp;nbsp;− A set of classes that describes the data you are working with as well as the business logic.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;li style=&quot;background-position: 0px 4px; background-repeat: no-repeat; box-sizing: border-box; color: black; line-height: 24px; list-style: outside none none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;The View&lt;/b&gt;&amp;nbsp;− Defines how the application’s UI will be displayed. It is a pure HTML, which decides how the UI is going to look like.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;li style=&quot;background-position: 0px 4px; background-repeat: no-repeat; box-sizing: border-box; color: black; line-height: 24px; list-style: outside none none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;The Controller&lt;/b&gt;&amp;nbsp;− A set of classes that handles communication from the user, overall application flow, and application-specific logic.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/ul&gt;
&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-align: left; text-shadow: 1px 1px 2px rgb(204, 204, 204);&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;
Idea Behind MVC&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The
 idea is that you&#39;ll have a component called the view, which is solely 
responsible for rendering this user interface whether that be HTML or 
whether it actually be UI widgets on a desktop application.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;The
 view talks to a model, and that model contains all of the data that the
 view needs to display. Views generally don&#39;t have much logic inside of 
them at all.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;In
 a web application, the view might not have any code associated with it 
at all. It might just have HTML and then some expressions of where to 
take pieces of data from the model and plug them into the correct places
 inside the HTML template that you&#39;ve built in the view.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; overflow-wrap: break-word; padding: 0px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , &amp;quot;geneva&amp;quot; , &amp;quot;tahoma&amp;quot; , &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;The
 controller that organizes is everything. When an HTTP request arrives 
for an MVC application, that request gets routed to a controller, and 
then it&#39;s up to the controller to talk to either the database, the file 
system, or the model.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;In
 this section, we will create a new MVC 5 application with Visual Studio
 2013 for Web and understand the basic building blocks of a MVC 
Application.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;First of all, setup a development environment to develop an ASP.NET MVC 5 application&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold; text-align: left;&quot;&gt;Note :&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #5b5b5b; text-align: left;&quot;&gt;Basic
 tutorials use MVC 5.2. However, all the basic tutorials are applicable 
to the previous version aso such as MVC 3.0 &amp;amp; MVC 4.0.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-size: medium; text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;color: #486a80; font-size: 1.8em; letter-spacing: -1px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;Development Environment setup:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;You
 can develop ASP.NET MVC application with appropriate version of Visual 
Studio and .NET framework, as you have seen in the previous section of 
version history.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; line-height: 1.6; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;Here, we will use MVC v5.2, Visual Studio 2013 for Web Express edition and .NET framework 4.5 to create MVC application.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;verdana&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;times&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;&lt;a href=&quot;http://www.visualstudio.com/downloads/download-visual-studio-vs&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #337ab7;&quot; target=&quot;_blank&quot;&gt;Download and install Visual Studio Express 2013&lt;/a&gt;&amp;nbsp;for Web-update3. Please check the&amp;nbsp;&lt;a href=&quot;http://www.visualstudio.com/en-us/products/visual-studio-express-vs&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: #337ab7;&quot; target=&quot;_blank&quot;&gt;System requirements&lt;/a&gt;&amp;nbsp;to install VS2013&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://mymvcworld.blogspot.com/feeds/6050848038003971143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/mvc-introduction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/6050848038003971143'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/3623174770832603697/posts/default/6050848038003971143'/><link rel='alternate' type='text/html' href='https://mymvcworld.blogspot.com/2019/03/mvc-introduction.html' title='MVC Introduction'/><author><name>TechnologyMvc</name><uri>http://www.blogger.com/profile/03703101397023818365</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGt-Hp7KYe-fboXlSnwopeHLb1Nu0wRETVbOFB9kMxtP7I37BdBjvFUqOoHMMsVXEmVrFHwIVJbgb9jfXOixAgQlxjbg79EsxAywYK6nkXNFg84EeU4wJirZzNzhcN81kXxaOEQTFXHOUD/s72-c/mvc-folder-structure.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>