Search code examples
pythonasp.netasp.net-mvcasp.net-mvc-4localserver

ASP.net MVC: How to access project from mobile via Local Server


Back when I wanted to test my static webpages on mobile, I would set up a Local Http Server using python like.. For example, if my page is at D:/myProject/index.html, I would use command line and go to >>D:/myProject/

Then use this line,

python -m http.server

To set up localhttpserver at port 8000. Then I would access from my mobile browser like

http://192.168.XXX.XXX:8000/index.html

But I'm very new to ASP MVC Web projects and have no idea how to access it through localserver or how to set up one. Say, my project is D:/mvcProject/exampleProject.sln. I tried setting up the same way as I did on simple webprojects up to D:/mvcProject but when I access the exampleProject.sln from browser, it's showing me the codelines instead of the view.

Please do enlighten me, holy light. I, an empty cup, seek for your wisdom. Thank you in advance!


Solution

  • A .sln file is for keeping together a group of projects that are part of your solution and not for defining the routing or paths. Your route that follows MVC structure is going the include your controller and a view that is tied to that controller. For example, if you have a Controller, ExampleController, and a view for that controller, ExampleDetail.cshtml,then your path will look something like:

    http://localhost/Example/ExampleDetail

    Please take some time to follow through an MVC tutorial, there are plenty out there.

    https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/introduction/getting-started

    https://www.tutorialspoint.com/asp.net_mvc/