Hi nauna,
Use the GeoCoordinate class GetDistanceTo method to calculate the distance.
Note : GeoCoordinate class is available in .NET Framework 4 and higher.
Add the System.Device reference from the .Net tab in your project to access GeoCoordinate class.
Check this example. Now please take its reference and correct your code.
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
double lat1 = 19.154732;
double long1 = 72.856847;
double lat2 = 19.174410;
double long2 = 72.860479;
System.Device.Location.GeoCoordinate source = new System.Device.Location.GeoCoordinate(lat1, long1);
System.Device.Location.GeoCoordinate destination = new System.Device.Location.GeoCoordinate(lat2, long2);
double distance = source.GetDistanceTo(destination);
Response.Write(Math.Round(Convert.ToDecimal(distance / 1000), 2) + " Kms.");
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim lat1 As Double = 19.154732
Dim long1 As Double = 72.856847
Dim lat2 As Double = 19.17441
Dim long2 As Double = 72.860479
Dim source As Device.Location.GeoCoordinate = New Device.Location.GeoCoordinate(lat1, long1)
Dim destination As Device.Location.GeoCoordinate = New Device.Location.GeoCoordinate(lat2, long2)
Dim distance As Double = source.GetDistanceTo(destination)
Response.Write(Math.Round(Convert.ToDecimal(distance / 1000), 2) & " Kms.")
End Sub
Output
2.22 Kms.