Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 2 of 2

The request failed with HTTP status 401: Unauthorized.

This is a discussion on The request failed with HTTP status 401: Unauthorized. within the Bing Maps and MapPoint Web Service 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 ...

  1. #1
    tualbuquerque is offline 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 02:34 PM.

  2. #2
    ASRKumar is offline Junior Member White Belt
    Join Date
    Jun 2010
    Posts
    3

    Re: The request failed with HTTP status 401: Unauthorized.

    Hi,

    I have faced this issue (some time back) while working on Axis Mappoint implementation and resolved by copying all Axis lib jar files (ex:commons-httpclient-3.1.jar) into my project lib folder. So, can you please check whether all required jar files for Mappoint connection are set in lib or classpath.

    Thanks,
    ASR

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Web Service responding 'Unauthorized'
    By matbeard in forum Bing Maps and MapPoint Web Service
    Replies: 1
    Last Post: 04-22-2008, 03:45 PM
  2. DESCO, LLC Achieves Intuit Gold Developer Status
    By Eric Frost in forum News and Announcements
    Replies: 0
    Last Post: 09-23-2006, 09:12 AM
  3. http request error 401: unauthorized
    By okanss in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-09-2005, 03:52 PM
  4. Status
    By Anonymous in forum MP2K Magazine Articles
    Replies: 0
    Last Post: 03-08-2005, 11:06 AM
  5. MapPoint WebService http 403 forbidden error
    By duongtuphong in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-06-2005, 04:00 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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