Creating your first aspnet mvc application - Part 3

preview_player
Показать описание
Text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

Slides

All ASP .NET MVC Text Articles

All ASP .NET MVC Slides

ASP.NET MVC Playlist

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

In this video we will discuss about
2. Understand how mvc request is processed as apposed to webform request

Creating an mvc application:
1. Open visual studio
2. Click File - New Project
3. Select "Web" from "Installed Templates" section
4. Select ASP.NET MVC 4 Web Application
5. Set Name="MVCDemo"
6. Click OK
7. Select "Empty" template. Select "Razor" as the ViewEngine. There are 2 built in view engines - Razor and ASPX. Razor is preferred by most mvc developers. We will discuss about Razor view engine in detail in a later video session.
8. At this point you should have an mvc application created.

Notice that in the solution explorer, you have several folders - Models, Views, Controllers etc. As the names suggest these folders are going to contain Models, Views, and Controllers. We will discuss about Models, Views, and Controllers in a later video session.

Now let's add a controller to our project.
1. Right Click on "Controllers" folder
2. Select Add - Controller
3. Set Controller Name = HomeController
4. Leave rest of the defaults and click "Add"

At this point run the application by pressing CTRL+F5. Notice that you get an error.

To fix this error, we need to add a view with name, "Index". We will discuss about views in detail in a later video session. Let's fix it another way. The following is the function that is automatically added to HomeController class
public ActionResult Index()
{
return View();
}

Change the return type of Index() function from "ActionResult" to "string", and return string "Hello from MVC Application" instead of View().
public string Index()
{
return "Hello from MVC Application";
}

1. In the solution explorer, right click on the project and select "Properties"
2. Click on "Web" tab
3. Select "Use Local IIS Web Server" radio button
5. Finally click on "Create Virtual Directory" button

In the URL "Home" is the name of the controller and "Index" is the method within HomeController class.

So the improtant point to understand is that the URL is mapped to a controller action method. Where as in web applications, the URL is mapped to a physical file. For example, in a web application, if we have to display the same message.
1. We add a webform and in the Page_load() event include Response.Write("Hello from ASP.NET Web Forms Application");
3. The Page load event gets executed and the message string is displayed.
Рекомендации по теме
Комментарии
Автор

Venkat I understand more in 12 minutes of your video than I did I 3 day course that cost thousands (paid by my company of course).
Keep up the good work brother.
Nothing is difficult if the teacher knows how to explain. Teaching is an art and you know how to teach.

tocobern
Автор

I study from paid online course, but I don't understand. Despite the title of the course is "Beginner". Then I seek more explanation from youtube. I found kudvenkat explain in simple way better than the paid course. Thanks Venkat.

AlbrechtJ
Автор

This needs updating. Visual Studio has changed a lot and it's very difficult to follow the demonstrations with 2019.

abj
Автор

Best Teacher Ever ! The video series have helped thousands of us to get a job because of him . Thank you Venkat !!!

sanjeetmanohar
Автор

Thank You Sir.Thanks a lot.Because of you only without much hands on experience I could crack interview of my dream company.But I have a suggestion here.Could you please create a video series on creating and entire project based on MVC so that we can have a good hands on experience on the same.It will be really amazing and we all will not face the issue on real time projects that we face today. There is no such video in YouTube.If you can do that it will be of great help.Thanks in advance.

niharnanda
Автор

Thank you for a very good explanation - I have been tasked with writing an ASP.NET MVC application at work (not having done any web dev before) and I have a feeling I am going to be watching a lot of your videos to get me up to speed!

euler
Автор

Dear Venkat,
This is the greatest MVC training series I can find online and I watched it 3 times already. Do you have any plan for an update series on MVC 6? Thank you sir!

Kpopz
Автор

Hello my friend kudvenkat, let me tell you that you did a great job with all tutorials I appreciate your job here and excellent work. All of your explanations in your videos is awesome and very clear. Keep going ahead

ingeMarrog
Автор

I had to stop at the end of this video to say what a fantastic explanation. Hats off to you, Kudvenkat!

kaligasm
Автор

Thank you Kudvenkat Chanel for All useful asp.net video tutorial .I'm a rookie programmer so, when I struct in my project I always watch your video to solve my problem I wish you'll continue to share you helpful video thank you

teesitnu
Автор

Hi Gaurav, you are absolutely right. In MVC most things are based on Conventions. A controller should have the word controller at the end and should inherit from IController interface either directly or indirectly.

Csharp-video-tutorialsBlogspot
Автор

Hi Shabit, thank you very much for taking time to answer this question. Keep up the good work of helping others. As, I am receiving lot of questions everyday from our youtube users, I am finding it extremely difficult to answer all the questions in time. With your help I am confident, we will be able to answer most questions in time. Appreciate your time and effort. God bless you.

Csharp-video-tutorialsBlogspot
Автор

Nobody can teach like So So great to see this.... Thanks a lot sir...

aarthiv
Автор

omfg kudvenkat why are you the only one who can teach .net everybody else wants to speak with as much technical jargon as they can squeeze into a sentence . I get more from your 5 year old videos then I do from anything else please make more videos I know it will take time though because your product is quality and get setup with a patreon account I would rather pay you then lynda.com or anybody else.

lordgaulo
Автор

thank you so much, you have made everything clear for us who come from webform applications

samueldiaz
Автор

myNote:
1. Create MVC: 0:21
2. Create WebForms: 1:14
3. Create HomeController MVC: 2:00
4. Run: inetmgr: 3:50
5. WebForms: 5:35
6. Different entry point: 7:16

qhenry
Автор

dev.server is for testing your app on the development server i.e localhost. dev.server cannot be used for production purpose. In my opinion it is always better to use IIS even for testing applications on development server as dev.server doesn't support many features of IIS. Please let me know if this is not clear, I will record and upload a video.

Csharp-video-tutorialsBlogspot
Автор

Thanks Venkat.  
you explain very well

lapide
Автор

Your videos are awesome! Great work! You have the art of "how to teach the right way"!!! God bless!

jorasvarma
Автор

You are truly helping society by this video tutorials. thanks a lot.

mayankkukadia
join shbcf.ru