2005-07-29, 05:23 AM
Does anyone know how to use c# to call a web site and enable Javascripts to run locally?
I am trying to update the weather plug-in to use the new msnbc format and one think I have noticed is that I can no longer figure how to directly access the weather web page by US zip code. I now have to use area codes even for US cities. I ave been trying to figure out a way to automatically map zip codes to area codes.
What I have discovered so far is that from my browser I can do it by typing in the URL http://weather.msn.com/search.aspx?weasearchstr=12121, where 12121 is the zip code.
In code I have tried to do the same but it does not work.
The webpage that comes back includes an error message in ot that says âA display error has occurred. To use this feature, you must allow the use of Javascript. To fix this error, try changing your security settings so that the use of Javascript is enabled.â
Does anyone know how to do this?
Thanks
Jeff
I am trying to update the weather plug-in to use the new msnbc format and one think I have noticed is that I can no longer figure how to directly access the weather web page by US zip code. I now have to use area codes even for US cities. I ave been trying to figure out a way to automatically map zip codes to area codes.
What I have discovered so far is that from my browser I can do it by typing in the URL http://weather.msn.com/search.aspx?weasearchstr=12121, where 12121 is the zip code.
In code I have tried to do the same but it does not work.
Code:
// See if this as a new style code or an old style US zip code
Stream stream = null;
if (this.areaCode.Length == 5)
stream = new WebClient().OpenRead("http://weather.msn.com/local.aspx?wealocations=wc:" + this.areaCode);
else
stream = new WebClient().OpenRead("http://weather.msn.com/search.aspx?weasearchstr="+this.areaCode);
StreamReader streamReader = new StreamReader(stream);
string webPage = streamReader.ReadToEnd();
stream.Close();
The webpage that comes back includes an error message in ot that says âA display error has occurred. To use this feature, you must allow the use of Javascript. To fix this error, try changing your security settings so that the use of Javascript is enabled.â
Does anyone know how to do this?
Thanks
Jeff