Visa ett inlägg
Oläst 2009-02-16, 10:06 #15
Micke_Ns avatar
Micke_N Micke_N är inte uppkopplad
Medlem
 
Reg.datum: May 2004
Inlägg: 159
Micke_N Micke_N är inte uppkopplad
Medlem
Micke_Ns avatar
 
Reg.datum: May 2004
Inlägg: 159
Vet inte riktigt om jag förstår problemet. Detta fungerar hur bra som helst för mig direkt i ett nytt VS projekt.

Kod:
if (!IsPostBack)
 * * * * * *{
 * * * * * * * *string formattedUri = @"http://sv.wikipedia.org/wiki/G%C3%B6ran_Persson";

 * * * * * * * *WebRequest webRequest = WebRequest.Create(formattedUri);

 * * * * * * * *HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();

 * * * * * * * *string jsonResponse = string.Empty;

 * * * * * * * *using (StreamReader sr = new StreamReader(response.GetResponseStream()))
 * * * * * * * *{
 * * * * * * * * * *jsonResponse = sr.ReadToEnd();
 * * * * * * * * * *Response.Write(jsonResponse);
 * * * * * * * *}
 * * * * * *}
De första raderna i svaret från StreamReadern är
Kod:
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"sv\" lang=\"sv\" dir=\"ltr\">\n\t<head>\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n\t\t<meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n\t\t<meta name=\"generator\" content=\"MediaWiki 1.15alpha\" />\n\t\t<meta name=\"keywords\" content=\"Göran Persson,Sveriges statsministrar,14 juni,16 mars,17 september,1949,1969,1971,1977,1979,1984\" />\
Micke_N är inte uppkopplad   Svara med citatSvara med citat