Lily, Can you please post your credentials so I can test them out and verify? Also the full piece of code would help a lot including your web.config file or wherever your credentials reside. Thanks, -- Infusion Development http://www.infusiondev.com "Lily" wrote: > I tested the credentials and they tested > fine. > But when use them in my application i get HTTP 401. Please help. I am using > the following code. > > NetworkCredential myCredentials = new NetworkCredential(myUserID, myPassword); > FindServiceSoap findService = new FindServiceSoap(); > findService.Credentials = myCredentials; > findService.PreAuthenticate = true; > FindAddressSpecification locationData = new FindAddressSpecification(); > locationData.DataSourceName = myDataSourceName; > locationData.InputAddress = mapAddress; > > findResults = findService.FindAddress(locationData); -- this is where i > get the error >
Here are my Credentials which i am using in my Web.config. <add key="MPUser" value="128534" /> <add key="MPPass" value="QW!123op" /> Here is the code. //Step 1 FindServiceSoap findService = new FindServiceSoap(); MapPointService.Address myAddress = new MapPointService.Address(); FindAddressSpecification findAddressSpec = new FindAddressSpecification(); //Step 2 myUserID = ConfigurationManager.AppSettings.Get("MPUser"); myPassword = ConfigurationManager.AppSettings.Get("MPPass"); findService.Credentials = new System.Net.NetworkCredential(myUserID, myPassword); findService.PreAuthenticate = true; //Step 3 myAddress.AddressLine = "1 Healthsouth Pkwy"; myAddress.PrimaryCity = "Birmingham"; myAddress.PostalCode = "35243"; myAddress.CountryRegion = "US"; //Step 4 findAddressSpec.DataSourceName = "MapPoint.NA"; findAddressSpec.InputAddress = myAddress; //Step 5 findResults = findService.FindAddress(findAddressSpec); for(int i=0;i<=findResults.Results.Length;i++){ Console.Out.Write(findResults.Results[i]); } LatLong latlong = new LatLong(); latlong = findResults.Results[0].FoundLocation.LatLong; ret = new MapCoordinate(float.Parse(latlong.Latitude.ToString()), float.Parse(latlong.Longitude.ToString())); return ret; } Appreciate your help. "Derek Chan" wrote: > Lily, > > Can you please post your credentials so I can test them out and verify? > Also the full piece of code would help a lot including your web.config file > or wherever your credentials reside. > > Thanks, > -- > Infusion Development > http://www.infusiondev.com > > > "Lily" wrote: > > > I tested the credentials and they tested > > fine. > > But when use them in my application i get HTTP 401. Please help. I am using > > the following code. > > > > NetworkCredential myCredentials = new NetworkCredential(myUserID, myPassword); > > FindServiceSoap findService = new FindServiceSoap(); > > findService.Credentials = myCredentials; > > findService.PreAuthenticate = true; > > FindAddressSpecification locationData = new FindAddressSpecification(); > > locationData.DataSourceName = myDataSourceName; > > locationData.InputAddress = mapAddress; > > > > findResults = findService.FindAddress(locationData); -- this is where i > > get the error > >
Lily, Are you behind a proxy? I tried your credentials out and they work fine for me. Regards, -- Infusion Development http://www.infusiondev.com "Lily" wrote: > Here are my Credentials which i am using in my Web.config. > > <add key="MPUser" value="128534" /> > <add key="MPPass" value="QW!123op" /> > > Here is the code. > > //Step 1 > FindServiceSoap findService = new FindServiceSoap(); > MapPointService.Address myAddress = new MapPointService.Address(); > FindAddressSpecification findAddressSpec = > new FindAddressSpecification(); > > //Step 2 > myUserID = ConfigurationManager.AppSettings.Get("MPUser"); > myPassword = ConfigurationManager.AppSettings.Get("MPPass"); > > findService.Credentials = > new System.Net.NetworkCredential(myUserID, myPassword); > findService.PreAuthenticate = true; > > //Step 3 > myAddress.AddressLine = "1 Healthsouth Pkwy"; > myAddress.PrimaryCity = "Birmingham"; > myAddress.PostalCode = "35243"; > myAddress.CountryRegion = "US"; > > //Step 4 > findAddressSpec.DataSourceName = "MapPoint.NA"; > findAddressSpec.InputAddress = myAddress; > > //Step 5 > findResults = findService.FindAddress(findAddressSpec); > for(int i=0;i<=findResults.Results.Length;i++){ > > Console.Out.Write(findResults.Results[i]); > } > LatLong latlong = new LatLong(); > latlong = findResults.Results[0].FoundLocation.LatLong; > > ret = new > MapCoordinate(float.Parse(latlong.Latitude.ToString()), > float.Parse(latlong.Longitude.ToString())); > return ret; > } > > Appreciate your help. > > > > "Derek Chan" wrote: > > > Lily, > > > > Can you please post your credentials so I can test them out and verify? > > Also the full piece of code would help a lot including your web.config file > > or wherever your credentials reside. > > > > Thanks, > > -- > > Infusion Development > > http://www.infusiondev.com > > > > > > "Lily" wrote: > > > > > I tested the credentials and they tested > > > fine. > > > But when use them in my application i get HTTP 401. Please help. I am using > > > the following code. > > > > > > NetworkCredential myCredentials = new NetworkCredential(myUserID, myPassword); > > > FindServiceSoap findService = new FindServiceSoap(); > > > findService.Credentials = myCredentials; > > > findService.PreAuthenticate = true; > > > FindAddressSpecification locationData = new FindAddressSpecification(); > > > locationData.DataSourceName = myDataSourceName; > > > locationData.InputAddress = mapAddress; > > > > > > findResults = findService.FindAddress(locationData); -- this is where i > > > get the error > > >