Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9111813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:35:28+00:00 2026-06-17T03:35:28+00:00

I have a problem in my MVC4 project in visual studio 2012. I build

  • 0

I have a problem in my MVC4 project in visual studio 2012.
I build a backoffice in symfony2 and there i can display google maps with polygons loaded from a kml file.

Now i am trying to do the same thing in asp.net (C#)… But my code doesn’t seem able to access the kml-file.

I am not using the Model View Controller system to acces my file, and maybe that is the problem…

i made a directory in my project named ‘Kmls’ and i pasted my kml in there (1.kml, 2.kml, …)
this is my code of my view:

@model IEnumerable<SocialGeo.Models.district>
@{
   ViewBag.Title = "Index";
}

<h3>Choose a district first</h3>

<ul class="allDistricts" data-kml="">
    @foreach (var item in Model) {
        @Html.ActionLink(item.district_name, "DistrictNews", new { id=item.district_id})
    }
</ul>

<script type="text/javascript">
  $(document).ready(function () {
    var myOptions = {
        center: new google.maps.LatLng(51.087633, 3.711569),
        zoom: 11,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    }



    var paths =
    {
        imagePath: "@Url.Content("~/Kmls/10.kml")"
    }


    $("section").append('<div class="mapscanvas" id="map_canvas' + 0 + '"></div>');

    map = new google.maps.Map(document.getElementById("map_canvas" + 0), myOptions);

    geoXml = geoXML3.parser({ map: map, singleInfoWindow: true, zoom: false });
    //var jej = @HttpContext.Current.Server.MapPath("~/Kmls/10.kml")

    geoXml.parse(paths.imagePath);

});
</script>

When i run the application (debugging) in firefox i get the following error in console:

GET: http://localhost:53760/Kmls/10.kml 404NotFound
HTTP error 404 retrieving /Kmls/10.kml in polys.js (line 990)
Unable to retrieve /Kmls/10.kml

I see the map, but not the polygon that I need.

Do I have to use a controller for this too?
this is my controlleraction that is being called:

public ActionResult Index()
{
    var districts = db.districts.Include(d => d.city);
    return View(districts.ToList()); 
}

Any help would be highly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:35:29+00:00Added an answer on June 17, 2026 at 3:35 am

    I think your problem may be that in order to load a KML file in Google Maps (at least for the free version), it needs to be Web Accessible (i.e. the URL you provide needs to be accessible from the web, not just locally on your development / production server). Therefore “/Kmls/10.kml” would not be a valid URL and something like “http://myserver/KML” is required.

    As provided in the comments below, here is a link to a similar answered question: Google Maps API and KML File LocalHost Development Options

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Visual Studio 2012, I created a new ASP.NET MVC 4 web project, using
I am having a weird problem with Page Inspector in Visual Studio 2012. Page
I have problem developing with live555. I already build the lib-files and example projects
I've recently repaved my machine with Windows 8 Pro x64 and Visual Studio 2012
I am starting to use MVC4 Web API project, I have controller with multiple
I have a ASP.NET MVC4 project with HTML5 semantic markup enabled. When using @Html.EditorFor(m
Actually I'm working on simple project MVC4 + EF in which I have relation
I'm developing an Azure/MVC4 application using Visual Studio Web Developer 2010 Express, on a
I have a problem that I suppose comes from my ASP.NET MVC project using
I have an MVC4 project, and I am trying to get it working on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.