Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/06/2004, 02:23
LastN
 
Fecha de Ingreso: julio-2003
Mensajes: 132
Antigüedad: 20 años, 9 meses
Puntos: 0
peticion via HttpWebRequest

Hola a todos
deseo recoger el contenido de una web dinamicamente con este codigo:


Código:
using System;
using System.Web; 
using System.Net;
using System.IO;  
using System.Text; 

namespace httpWeb
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	class Class1
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			
			string url="http://www.dofactory.com/Curriculum/Curriculum.aspx";
			string contentType="";
			string content="";
			string method="GET";			

			HttpWebRequest req = (HttpWebRequest ) WebRequest.Create(url);
			req.ContentType=contentType;
			req.Method = method;
			req.ContentLength=content.Length;
			Stream s;
			s = req.GetRequestStream();
			StreamWriter sw = new StreamWriter(s,Encoding.ASCII);
			sw.Write(content);
			sw.Close();
			
			HttpWebResponse res = (HttpWebResponse)	req.GetResponse();
			s = res.GetResponseStream();
				
			StreamReader sr = new StreamReader(s,Encoding.ASCII);
			StringBuilder sb = new StringBuilder();
			char [] data = new char[1024];
			int nBytes;
			do 
			{
				  nBytes = sr.Read(data,0,(int)1024);
				  sb.Append(data);
			} while (nBytes == 1024);
		}
	}
}


El error es el siguiente:
No se puede enviar contenido textual con este tipo de verbo.

Cuando hago :
GetRequestStream

Alguien me puede ayudar?
Gracias de antemano