You need to use a HttpWebRequest something like (and this may not be 100%
correct):
HttpWebRequest rqst =
(HttpWebRequest)WebRequest.Create(http://localhost/Prueba/rss.aspx);
rqst.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse rsp = (HttpWebResponse)request.GetResponse ();
XmlTextReader rdr = new XmlTextReader(rsp.GetResponseStream());
--
- Paul Glavich
MVP ASP.NET
http://weblogs.asp.net/pglavich ASPInsiders member -
http://www.aspinsiders.com [quoted text, click to view] "Marcos Martínez" <marcos@#¡QUITAESTO!#villamalea.com> wrote in message
news:dh918f$oec$1@nsnmpen3-gest.nuria.telefonica-data.net...
>I am trying to generate and to consume a file RSS dinamicamente. I generate
>it correctly, if I call from the explorer
>(http://localhost/Prueba/rss.aspx) or an application client RSS Bandit, for
>example, everything works costraight.
> But if I want to load "http://localhost/Prueba/rss.aspx" in a pagina
> (http://localhost/Prueba/Lector.aspx) in metodo Page_Load:
> XmlTextReader reader = null;
> try
> {
> //Get the XML data
> reader = new XmlTextReader(http://localhost/Prueba/rss.aspx);
>
> // return a new DataSet
> DataSet ds = new DataSet();
> ds.ReadXml(reader);
> }
> catch
> {
> throw;
> }
> finally
> {
> if(reader!=null)
> reader.Close();
> }
> It gives a WebException - "Error in the remote server: (401) nonauthorized
> "and I do not understand because.
> That it happens? Because can be read from other applications and no in the
> same Web site?
> A greeting and thanks.
> Marcos
> ***************************************************************************
> Estoy intentando generar y consumir dinamicamente un archivo RSS.Lo genero
> correctamente, si lo llamo desde el explorador
> (http://localhost/Prueba/rss.aspx) o una aplicación cliente RSS Bandit,
> por ejemplo, todo funciona corectamente.
> Pero si quiero cargar "http://localhost/Prueba/rss.aspx" en una pagina
> (http://localhost/Prueba/Lector.aspx) en el metodo Page_Load:
> XmlTextReader reader = null;
> try
> {
> //Get the XML data
> reader = new XmlTextReader(http://localhost/Prueba/rss.aspx);
>
> // return a new DataSet
> DataSet ds = new DataSet();
> ds.ReadXml(reader);
> }
> catch
> {
> throw;
> }
> finally
> {
> if(reader!=null)
> reader.Close();
> }
> Da un WebException - "error en el servidor alejado: (401) nonauthorized "y
> no entiendo porque.
> ¿Que sucede? ¿Porque puede ser leído en otros usos y no en el mismo sitio
> del Web?
> Un saludo y gracias.
> Marcos
>