dcsimg
Results 1 to 8 of 8

Thread: Basic flow of MVC website

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2015
    Posts
    81

    Basic flow of MVC website

    I'm confused about the most basic flow of an MVC website.

    I have a website on my local server that I managed to get running using IIS and ASP.NET MVC.

    Suppose in my browser I enter "http://10.4.70.172:81/report/dashboard"

    What happens?

    This is my vague guess:

    1. IIS looks at the address only up to the port "http://10.4.70.172:81" and finds what physical folder it is mapped to.

    2. Then IIS tries to open a file in that folder based on something? Is it Global.asax?

    3. Then the "report" controller gets called based on the "/report" part of the address.

    4. Then the "dashboard" method gets called based on the "/dashboard" part of the address.


    Thanks!


    Edit:

    The real reason I'm trying to understand this is I'm trying to figure out how to organize multiple web applications. Will they all be in one asp.net mvc project? Or separate projects in separate folders on the web server? Would the user have different URL shortcuts? Like "http://10.4.70.172:81/report/dashboard" and "http://10.4.70.172:81/report/accounting_report"?
    Last edited by madison320; Dec 20th, 2019 at 01:17 PM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,121

    Re: Basic flow of MVC website

    Separate web applications would be separate projects in VS. They might be in the same solution, if they are related, or you might have a separate solution for each one. You then add them to IIS as separate applications. They might be virtual applications under one main if there's an appropriate relationship or they might all be completely independent.

    I don;t know all the details myself but I do know that, at the point that IIS recognises that it's dealing with an ASP.NET application, it hands off responsibility to ASP.NET. It is ASP.NET, not IIS, that handles the routing.

  3. #3
    Frenzied Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    1,165

    Re: Basic flow of MVC website

    When you look at the URL http://10.4.70.172:81/report/dashboard there are several different parts to it - the only bit that makes any difference in MVC is the path portion e.g. /report/dashboard in your example.

    Depending on exactly which version of MVC you are using there may be different ways, by default in different places that say exactly how the path portion is handled.

    MVC has a concept called routing, this is responsible for taking the path and mapping it to a controller action, the default rout would indeed assume that the path /report/dashboard is pointing to the dashboard action on the report controller - however if any custom routes have been defined that might not be the case.


    If you are creating separate projects then each project would typically run as it's own application with it's own URL, although by creating a separate application under IIS for each MVC application you could sort of arrange things so the different websites appear to b part of the same URL structure.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2015
    Posts
    81

    Re: Basic flow of MVC website

    Quote Originally Posted by PlausiblyDamp View Post
    When you look at the URL http://10.4.70.172:81/report/dashboard there are several different parts to it - the only bit that makes any difference in MVC is the path portion e.g. /report/dashboard in your example.

    Depending on exactly which version of MVC you are using there may be different ways, by default in different places that say exactly how the path portion is handled.

    MVC has a concept called routing, this is responsible for taking the path and mapping it to a controller action, the default rout would indeed assume that the path /report/dashboard is pointing to the dashboard action on the report controller - however if any custom routes have been defined that might not be the case.


    If you are creating separate projects then each project would typically run as it's own application with it's own URL, although by creating a separate application under IIS for each MVC application you could sort of arrange things so the different websites appear to b part of the same URL structure.
    What's confusing me is how to create a separate URL. We have an internal server that we are using as our web server. As far as I can tell there's no way for me to map that internal IP address to a URL name so I've just been using the IP address, like http://10.4.70.172:81/report/dashboard. The only way I can see to create a separate URL is to use another port number like http://10.4.70.172:82. I think that would work but it seems a little weird.

    So suppose I had two completely separate projects, Project1 and Project2 that happened to have the same path structure

    I could have two different URLs like this mapped to two different physical folders:

    Project1: http://10.4.70.172:81/mvc_path1/mvc_path2 located on physical drive c:\Project1


    Project2: http://10.4.70.172:82/mvc_path1/mvc_path2 located on physical drive c:\Project2

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,121

    Re: Basic flow of MVC website

    If you want to use URLs rather than IP addresses and port numbers then you need to configure your internal DNS. DNS is what maps between the two. That is nothing to do with ASP.NET or even IIS.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2015
    Posts
    81

    Re: Basic flow of MVC website

    Quote Originally Posted by jmcilhinney View Post
    If you want to use URLs rather than IP addresses and port numbers then you need to configure your internal DNS. DNS is what maps between the two. That is nothing to do with ASP.NET or even IIS.
    Can any user on the network set up an internal DNS? I'm assuming I'd need some type of admin privilege on our network.

  7. #7
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,121

    Re: Basic flow of MVC website

    Quote Originally Posted by madison320 View Post
    Can any user on the network set up an internal DNS? I'm assuming I'd need some type of admin privilege on our network.
    That's not really a question for an ASP.NET forum.

  8. #8
    Banned
    Join Date
    Dec 2019
    Posts
    9

    Re: Basic flow of MVC website

    Totally agree here, not an ASP.NET thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width