MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




The request failed with HTTP status 401: Unauthorized.

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint Web Service and Virtual Earth

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  6 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 04-23-2007
Junior Member
White Belt
 
Join Date: Apr 2007
Posts: 1
The request failed with HTTP status 401: Unauthorized.

Hi,

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
{
///
/// Summary description for WebForm1.
///

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);
}

///
/// Required method for Designer support - do not modify
/// 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/request-failed-http-status-401-unauthorized-5846.html

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 02:32 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51