How to Show Google map in MVC Web Application

Steps:

  1. Open Visual studio and create a new MVC Project.

  2. Then save the project in your local machine workspace.

  3. First create a folder in View named Location.

  4. Add cshtml in that location folder called Index.

  5. Now right click on controller-> Add->Controller->name it as Location.

  6. Make sure Index method is in controller.

  7. Now go to index page and copy below code.

index page

Code

Add the coordinates as your wish, from Google map. But the end result looks like:

Map

Try this and let me know, if you face any difficulties. Thanks.