Click here to Skip to main content
Licence 
First Posted 3 Apr 2007
Views 14,161
Downloads 84
Bookmarked 5 times

Another Simple Yahoo Map Proxy

By | 3 Apr 2007 | Article
Another Simple Yahoo Map Proxy

Introduction

When alot people try to code their first AJAX code in localhost, "Access Denied" Often pop-up . Therefore, I code up a very simple Yahoo map proxy sample to solve this problem

Background

Got this idea from the simple php proxy by Jason Levitt

Using the code

SimpleDotNetProxy.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.IO;
using System.Text;

namespace SimpleDotNetProxy
{
    public partial class simpleProxy : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string requestString = "";
            string host = "http://api.local.yahoo.com/";
            for (int i = 0; i < Page.Request.QueryString.Count; i++)
            {
                if (!Page.Request.QueryString.Keys[i].Equals("yws_path"))
                {
                    requestString += "&" + Page.Request.QueryString.Keys[i] + "=" + Page.Request[Page.Request.QueryString.Keys[i]];
                }
            }

            host += Page.Request["yws_path"].ToString() + requestString;
            //Response.Write(host);
            //Response.End();
            
            WebRequest request = WebRequest.Create(host);
            WebResponse response = request.GetResponse();
            Stream recieveStream = response.GetResponseStream();
            StreamReader readStream = new StreamReader(recieveStream, Encoding.Default);
            string content = readStream.ReadToEnd();
          
            this.Response.Write(content);



        }

        
    }
}

Remember removing all the tag from the aspx file


License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

jebberwocky



China China

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralI need an example PinmemberKhaled Al-Noami10:35 8 Apr '07  
GeneralRe: I need an example Pinmemberjebberwocky18:52 8 Apr '07  
GeneralRe: I need an example PinmemberKhaled Al-Noami19:04 8 Apr '07  
Generalhttp://omega-watch-price.tangoing.info/ Pinsusshttp://omega-watch-price.tangoing.info/10:56 4 Dec '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 3 Apr 2007
Article Copyright 2007 by jebberwocky
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid