Link to home
Start Free TrialLog in
Avatar of pamela rizk
pamela rizkFlag for Lebanon

asked on

asp Google Map

hi
i have created a web form frm_map.aspx structured as below:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Frm_Map.aspx.vb" Inherits="Frm_Map" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Google Maps Example</title>
     <script type="text/javascript"
        src="http://www.google.com/jsapi?key=AIzaSyDtWpEfoVxSKPTzKKFmYq1RP-isfqWLFGA"></script>
     <script type="text/javascript">
         google.load("maps", "2");
         // Call this function when the page has been loaded
         function initialize() {
             var map = new google.maps.Map2(document.getElementById("map"));
             map.setCenter(new google.maps.LatLng("<%=lat%>", "<%=lon%>"), 5);
        var point = new GPoint("<%=lon%>", "<%=lat%>");
          var marker = new GMarker(point);
          map.addOverlay(marker);
          map.addControl(new GLargeMapControl());
      }
      google.setOnLoadCallback(initialize);
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div id="map" style="width: 400px; height: 400px"></div>
    </div>
    </form>
</body>

Open in new window


below is it code behind :
Imports System.Data
Imports System.Net

Partial Class Frm_Map
    Inherits System.Web.UI.Page
    Protected lat As String, lon As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim ipaddress As String
        ipaddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
        If ipaddress = "" OrElse ipaddress Is Nothing Then
            ipaddress = Request.ServerVariables("REMOTE_ADDR")
        End If
       
        lat = "33.55"
        lon = "55.45"
       
    End Sub

    
End Class

Open in new window


after running this form i am getting the below error message
his page didn't load Google Maps correctly. See the JavaScript console for technical details.

below is the attach erroe
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial