KailasE
asked on
How to get AppID ? I tried getting one from my yahoo login. Still my application does not work under the firewall. Can anybody explain me the usage of it under the firewall ?
I tried getting one from my yahoo login. Still my application does not work under the firewall. Can anybody explain me the usage of it under the firewall ?
Your question is hard to understand, could you try and rephrase it please?
ASKER
Yes. I am trying to write a C# application using yahoo's webservices for Geocoding. I am giving an HttpWebRequest with the dummy AppId generated.
string url = "http://local.yahooapis.com/MapsService/V1/geocode?appid=35jF1DfV34HKjqV6hOQvXaXUv3Gui63U2_EAX44gFRylBAqLBDtDZK_KuG8qzcjYYkMZ&street=pune&city=Pune&state=India";
WebRequest req = HttpWebRequest.Create(url) ;
WebResponse res = req.GetResponse();
Now if I give the url in browser, it returns me the data but if I do it in application it is failing.
I am working on a PC which is firewalled under my company proxy.
string url = "http://local.yahooapis.com/MapsService/V1/geocode?appid=35jF1DfV34HKjqV6hOQvXaXUv3Gui63U2_EAX44gFRylBAqLBDtDZK_KuG8qzcjYYkMZ&street=pune&city=Pune&state=India";
WebRequest req = HttpWebRequest.Create(url)
WebResponse res = req.GetResponse();
Now if I give the url in browser, it returns me the data but if I do it in application it is failing.
I am working on a PC which is firewalled under my company proxy.
And you think the firewaqll is maybe to blame.
Can you test your code outside of the firewall?
Can you test your code outside of the firewall?
ASKER
I am afraid, I cant test it outside firewall.
Ok so I knocked this together and it works for me.
So what is your actualy question - how to get this through the firewall?
Can you test my code too just to check it doesn't work with your firewall - ie it's not a fault with yopur code.
So what is your actualy question - how to get this through the firewall?
Can you test my code too just to check it doesn't work with your firewall - ie it's not a fault with yopur code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace YahooTest
{
class Program
{
static void Main(string[] args)
{
string url = "http://local.yahooapis.com/MapsService/V1/geocode?appid=35jF1DfV34HKjqV6hOQvXaXUv3Gui63U2_EAX44gFRylBAqLBDtDZK_KuG8qzcjYYkMZ&street=pune&city=Pune&state=India";
WebRequest req = HttpWebRequest.Create(url);
WebResponse res = req.GetResponse();
Stream receiveStream = res.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
StreamReader readStream = new StreamReader(receiveStream, encode);
Console.WriteLine("\r\nResponse stream received.");
Char[] read = new Char[256];
int count = readStream.Read(read, 0, 256);
Console.WriteLine("HTML...\r\n");
while (count > 0)
{
String str = new String(read, 0, count);
Console.Write(str);
count = readStream.Read(read, 0, 256);
}
Console.WriteLine("");
res.Close();
readStream.Close();
Console.Read();
}
}
}
Yahoo.gif
ASKER
Hello..
Thanks for your efforts.
I am getting an WebException - The underlying connection was closed: An unexpected error occurred on a receive. [This happens if I dont specfy the proxy]
If I specify proxy using the call as shown below
WebRequest req = HttpWebRequest.Create(url) ;
req.Proxy = new WebProxy("---- my proxy------ ", false, new string[0]);
then I get WebException as - The remote server returned an error: (404) Not Found.
Can we conclude on something with this result. Since I am new to C# coding I am not able to figure out the problem.
Thanks for your efforts.
I am getting an WebException - The underlying connection was closed: An unexpected error occurred on a receive. [This happens if I dont specfy the proxy]
If I specify proxy using the call as shown below
WebRequest req = HttpWebRequest.Create(url)
req.Proxy = new WebProxy("---- my proxy------ ", false, new string[0]);
then I get WebException as - The remote server returned an error: (404) Not Found.
Can we conclude on something with this result. Since I am new to C# coding I am not able to figure out the problem.
Ok this is a bit of a guess but try this:
req.Proxy = WebRequest.DefaultWebProxy ;
So we have...
using System;
using System.Collections.Generic ;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace YahooTest
{
class Program
{
static void Main(string[] args)
{
string url = "http://local.yahooapis.com/MapsService/V1/geocode?appid=35jF1DfV34HKjqV6hOQvXaXUv3Gui63U2_EAX44gFRylBAqLBDtDZK_KuG8qzcjYYkMZ&street=pune&city=Pune&state=India";
WebRequest req = HttpWebRequest.Create(url) ;
req.Proxy = WebRequest.DefaultWebProxy ;
....... and so on
req.Proxy = WebRequest.DefaultWebProxy
So we have...
using System;
using System.Collections.Generic
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace YahooTest
{
class Program
{
static void Main(string[] args)
{
string url = "http://local.yahooapis.com/MapsService/V1/geocode?appid=35jF1DfV34HKjqV6hOQvXaXUv3Gui63U2_EAX44gFRylBAqLBDtDZK_KuG8qzcjYYkMZ&street=pune&city=Pune&state=India";
WebRequest req = HttpWebRequest.Create(url)
req.Proxy = WebRequest.DefaultWebProxy
....... and so on
ASKER
oops.. getting a WebException again.. The underlying connection was closed: An unexpected error occurred on a receive.
Ok could we try WebCliet instead?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace YahooTest
{
class Program
{
static void Main(string[] args)
{
WebClient client = new WebClient();
string data = client.DownloadString("http://local.yahooapis.com/MapsService/V1/geocode?appid=35jF1DfV34HKjqV6hOQvXaXUv3Gui63U2_EAX44gFRylBAqLBDtDZK_KuG8qzcjYYkMZ&street=pune&city=Pune&state=India");
Console.WriteLine(data);
Console.Read();
}
}
}
ASKER
nopes Dave:(
getting a WebException again.. The underlying connection was closed: An unexpected error occurred on a receive.
Are you trying to run the exe on ur personal computer or does it have any domain / firewall setting?
getting a WebException again.. The underlying connection was closed: An unexpected error occurred on a receive.
Are you trying to run the exe on ur personal computer or does it have any domain / firewall setting?
I am at work but not using a proxy.
If what you are doing is for work, maybe you need to speak with your firewall administartor?
If what you are doing is for work, maybe you need to speak with your firewall administartor?
ASKER
There is a catch here.. If I type in the url in web browser (IE 7 or firefox 2) then it responds with correct output. I tried to use sniffer tool for IE there it gives me an error
-------------------------- -
407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied. )
--------------------------
still I could see the output in browser. Can you help me to understand the issue ?
--------------------------
407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied. )
--------------------------
still I could see the output in browser. Can you help me to understand the issue ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This actually works without proxy. Proxy setting has something to do with it so the question is partially resolved.
Ok nice one