是否可以在ASP.NET谷歌地图应用程序中提供不同的谷歌API密钥? 我在我的应用程序中使用的是googlemaps.subgurim.net,可以根据不同用户的登录设置不同的GOOGLE API密钥。 web.config: .aspx: .aspx.cs: 字符串sMapKey=ConfigurationManager.AppSettings[“googlemaps.subgurim.net”]; 地理编码objAddress=新地理编码(); objAddress=Map.geoCodeRequest(newGLatLng(Convert.ToDouble(status.Rows[0][0])、Convert.ToDouble(status.Rows[0][1])、sMapKey); StringBuilder sb=新的StringBuilder(); if(objAddress.valid) { sb.Append(objAddress.Placemark.address.ToString()); lbladd.Text=sb.ToString(); }

是否可以在ASP.NET谷歌地图应用程序中提供不同的谷歌API密钥? 我在我的应用程序中使用的是googlemaps.subgurim.net,可以根据不同用户的登录设置不同的GOOGLE API密钥。 web.config: .aspx: .aspx.cs: 字符串sMapKey=ConfigurationManager.AppSettings[“googlemaps.subgurim.net”]; 地理编码objAddress=新地理编码(); objAddress=Map.geoCodeRequest(newGLatLng(Convert.ToDouble(status.Rows[0][0])、Convert.ToDouble(status.Rows[0][1])、sMapKey); StringBuilder sb=新的StringBuilder(); if(objAddress.valid) { sb.Append(objAddress.Placemark.address.ToString()); lbladd.Text=sb.ToString(); },asp.net,google-maps,subgurim-maps,Asp.net,Google Maps,Subgurim Maps,在我的应用程序中,我使用的是googlemaps.subgurim.net,可以根据不同用户的登录设置不同的GOOGLE API密钥。是的。您需要将其API密钥保存在用户记录中,例如数据库中,然后在API脚本中切换变量 网络表单 I am using googlemaps.subgurim.net in my application,it is possible to set different GOOGLE API KEY to different users based on their

在我的应用程序中,我使用的是googlemaps.subgurim.net,可以根据不同用户的登录设置不同的GOOGLE API密钥。

是的。您需要将其API密钥保存在用户记录中,例如数据库中,然后在API脚本中切换变量

网络表单

  I am using googlemaps.subgurim.net in my application,it is possible to set different GOOGLE API KEY to different users based on their logins.
              web.config:        
            <add key="googlemaps.subgurim.net" value="xxxxxxxxx"/>       
            .aspx:        
            <cc1:GMap ID="GMap1" runat="server" Height="805px" Width="800px" />       
            .aspx.cs:        
            string sMapKey = ConfigurationManager.AppSettings["googlemaps.subgurim.net"];
            GeoCode objAddress = new GeoCode();          
            objAddress=Map.geoCodeRequest(newGLatLng(Convert.ToDouble(status.Rows[0][0]),Convert.ToDouble(status.Rows[0][1])), sMapKey);
                                    StringBuilder sb = new StringBuilder();
                                    if (objAddress.valid)
                                    {
                                        sb.Append(objAddress.Placemark.address.ToString());
                                        lbladd.Text = sb.ToString();
                                    }    

MVC



如果APi键为null,那么在Getter中切换默认值可能是值得的。

这里我使用的是:我没有使用javascript Google控件…您是否正在尝试执行字符串sMapKey=ConfigurationManager.AppSettings[“googlemaps.subgurim.net”];或字符串sMapKey=ConfigurationManager.AppSettings[“googlemaps.xyz.net”];ConfigurationManager.AppSettings[User.ApiKey];用户在哪里是您的用户类??
<script type="text/javascript"
  src="https://maps.googleapis.com/maps/api/js?key=<%=User.ApiKey%>&sensor=SET_TO_TRUE_OR_FALSE">
</script>
<script type="text/javascript"
  src="https://maps.googleapis.com/maps/api/js?key=@Model.UserApiKey&sensor=SET_TO_TRUE_OR_FALSE">
</script>