I wish to render a KML file in the search engines maps from the asp.internet MVC 3 application.

From Google Maps JavaScript API V3, I am using KmlLayer('url') to render the kml in the search engines maps. I've read that kml file must be inside a openly accessible server. I possibly could render the kml file in your area with 3rd party javascripts but they may be vulnerable to errors. (Loading a local .kml file using google maps?)

The kml files I wish to render are saved inside a SQL server database as byte arrays. So for just one Kml file I must write the byte array right into a path with kml extension. I've carried this out with File.WriteAllBytes(path, byte), where path = local path and byte = byte array from Database. This really is completed in the Controller of MVC application. This is actually the code:

public ActionResult MapView(int id)
        {
          Incident inc = db.Incidents.Find(id);
            if (inc.IncidentDatas.Count != 0)
            {
                ViewBag.ListKmlUrls = kmlFileStore(inc);
            }

            return View(inc);
        }

public List<string> kmlFileStore(Incident inc)
        {
            List<string> listKmlUrls = new List<string>();
            // Specify a "currently active folder"
            string activeDir = @"c:\incident" + inc.incId + @"\incidentData";

            //Create a new subfolder under the current active folder
            string newPath = System.IO.Path.Combine(activeDir, "kmlFiles");

            // Create the subfolder
            System.IO.Directory.CreateDirectory(newPath);

            String url;
            foreach(var d in inc.IncidentDatas) {
                url = @"c:\incident" + inc.incId + @"\incidentData\kmlFiles\" + d.id + ".kml";

                 //dataContent is byte[]
                System.IO.File.WriteAllBytes(url, d.dataContent);
                listKmlUrls.Add(url);
            }

            return listKmlUrls;
        }

The concept may be the view will access their email list of web addresses through viewbag to pass through web addresses to javascript method KmlLayer(...). However the web addresses listed here are only local pathways.

Just how can the MVC application keep kml file to some openly accessible server to ensure that it may pass a hyperlink to KmlLayer(...)? This would need to be achieved programmatically.

I am presently being able to access my MVC application and database from localhost. I've got a static Ip and title. I'd like to write the application and database for online access. Unsure what direction to go, please produce top tipsOrassistance. Thanks.