Community of VE/MapPoint Users and Developers
This is a discussion on The request failed with HTTP status 401: Unauthorized. within the MapPoint Web Service and Virtual Earth forums, part of the Map Forums category; Hi, My aithentication information works fine (6 digit ID and Web services password). But I keep gettig HTTP 401. Any ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| The request failed with HTTP status 401: Unauthorized. My aithentication information works fine (6 digit ID and Web services password). But I keep gettig HTTP 401. Any thoughts? Thanks in advance, Tulio Code below================================= using System; using System.Drawing; using System.IO; using System.Web; using BREWServer.MapPointService; using System.Collections.Specialized; using System.Web.UI.HtmlControls; namespace BREWServer { /// /// publicclass WebForm1 : System.Web.UI.Page { privatevoid Page_Load(object sender, System.EventArgs e) { RenderServiceSoap renderService = new RenderServiceSoap(); renderService.PreAuthenticate = true; renderService.Credentials = new System.Net.NetworkCredential("******", "***********"); ViewByScale[] myViews = new ViewByScale[1]; myViews[0] = new ViewByScale(); myViews[0].CenterPoint = new LatLong(); NameValueCollection coll=Request.QueryString; String latlon = coll.GetValues("latlon")[0]; int sep = latlon.LastIndexOf("^"); String lat = latlon.Substring(0, sep); String lon = latlon.Substring(sep + 1, latlon.Length - (sep + 1)); myViews[0].CenterPoint.Latitude = Double.Parse(lat) / 3106; myViews[0].CenterPoint.Longitude = Double.Parse(lon) / -3106; myViews[0].MapScale = 100000; MapSpecification mapSpec = new MapSpecification(); mapSpec.DataSourceName = "MapPoint.NA"; mapSpec.Views = myViews; MapImage[] mapImages; mapImages = renderService.GetMap(mapSpec); Context.Response.Clear(); Context.Response.Cache.SetCacheability(HttpCacheab ility.NoCache); Context.Response.ContentType = mapImages[0].MimeData.MimeType; MemoryStream ms = new MemoryStream(mapImages[0].MimeData.Bits); Image i = Image.FromStream(ms); i.Save("c:\\brew\\btmp.png", System.Drawing.Imaging.ImageFormat.Png); FileStream fs = new FileStream("c:\\brew\\btmp.png", FileMode.Open); byte[] b = newbyte[fs.Length]; fs.Read(b, 0, b.Length); Context.Response.BinaryWrite(b); fs.Close(); File.Delete("c:\\brew\\btmp.png"); Context.Response.End(); } #region Web Form Designer generated code overrideprotectedvoid OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// the contents of this method with the code editor. /// privatevoid InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } } Last edited by tualbuquerque; 04-24-2007 at 01:34 PM. |
![]() |
| ||||
| Posted By | For | Type | Date | |
| Extending the MapPoint ActiveX Control - Pt. I - MapPoint Articles - MP2K Magazine | This thread | Refback | 05-09-2007 12:06 PM | |
| Working With Excel and MapPoint - MP2K Magazine | This thread | Refback | 05-08-2007 12:34 AM | |
| Caravel - Next Generation Platform for Mobile Mapping - MapPoint News - MP2K Magazine | This thread | Refback | 04-28-2007 05:32 PM | |
| Spatial Data Importer Contest Submission - MP2K Magazine | This thread | Refback | 04-24-2007 08:00 PM | |
| Microsoft MapPoint 2006 - MP2K Magazine | This thread | Refback | 04-24-2007 06:54 PM | |
| About MP2Kmag - MP2K Magazine | This thread | Refback | 04-24-2007 06:32 PM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Web Service responding 'Unauthorized' | matbeard | MapPoint Web Service and Virtual Earth | 1 | 04-22-2008 02:45 PM |
| DESCO, LLC Achieves Intuit Gold Developer Status | Eric Frost | News and Announcements | 0 | 09-23-2006 08:12 AM |
| http request error 401: unauthorized | okanss | MapPoint 2006/2009 Discussion | 1 | 06-09-2005 02:52 PM |
| Status | Anonymous | MP2K Magazine Articles | 0 | 03-08-2005 10:06 AM |
| MapPoint WebService http 403 forbidden error | duongtuphong | MapPoint 2006/2009 Discussion | 0 | 02-06-2005 03:00 PM |
Ski Travel
Holiday Hypermarket wants to make ski travel easy for you. Find out key information about destinations in our travel guides. We search leading tour operators for great value ski travel.
City Break Holidays
Book city break holidays through Travel Counsellors. A personal travel advisor will help with your city break holiday plans.
Cape Town Flights
Book Cape Town flights through dealchecker.co.uk to get a great deal. Cape Town has fantastic weather and a wide range of activities to keep you busy.
Cancun Holidays
Cancun holidays offer beautiful scenery, calm waters and plenty of shopping. Get a taste of the good life while on holiday in Cancun.
Cheap Cyprus Holidays
Finding cheap Cyprus holidays can be difficult unless you know where to look and where to book. With ulookubook.com you can conduct a simple search to find the latest holiday deals to your particular destination.
Compare Holidays
Compare holidays online where you can see all the amazing possibilities at Travel.co.uk
Sharm el Sheikh Holidays
Visit Egypt! Get info on Sharm El Sheikh holidays, only at On The Beach.