NOTANSWERED BEFORE: Invalid URI Exception
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngescalate' list.


Devin Rader
I am trying to load some XML from a WebDAV query into a dataset but keep
getting an Invalid URI exception. Heres the code:

StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);
if (IStream.Peek() > 0)

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);

Any ideas why?

Thanks

Devin

| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
 
    
Little, Ambrose
Don't suppose you could show us the code that builds the "r" object?
My experience with that exception is that it was not a fully-formed URI.

--Ambrose

-----Original Message-----
From: Devin Rader [mailto:Click here to reveal e-mail address]
Sent: Friday, 22 March, 2002 15:32
To: aspngescalate
Subject: [aspngescalate] NOTANSWERED BEFORE: Invalid URI Exception

I am trying to load some XML from a WebDAV query into a dataset but keep
getting an Invalid URI exception. Heres the code:

StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);
if (IStream.Peek() > 0)

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);

Any ideas why?

Thanks

Devin

| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
Reply to this message...
 
    
Devin Rader
No Problem...

Heres most of the code in the Method:

     HttpWebRequest w = (HttpWebRequest)WebRequest.Create(strURL);
w.Credentials=new System.Net.NetworkCredential("User", "Password",
"DMA");
w.Method="SEARCH";
w.ContentType="text/xml";
w.ContentLength = System.Text.Encoding.ASCII.GetChars(tmp).Length;

     StreamWriter s = new
StreamWriter(w.GetRequestStream(),System.Text.Encoding.ASCII);
s.Write(System.Text.Encoding.ASCII.GetChars(tmp));
s.Flush();
s.Close();

w.Accept HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT"];
w.Headers["Accept-Language"] HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"];
w.Headers.Add("depth","0");

w.Headers.Add("translate", "f");
w.Headers["Accept-Encoding"] HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_ENCODING"];
w.UserAgent HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"];

try
{
HttpWebResponse r = (HttpWebResponse)w.GetResponse();

StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);
}
catch (Exception exc)
{}

You can see that the XML is begin returned from a HttpWebRequest via an
HttpWebResponse object, and is then loaded into an StreamReader.

I have been able to create a new XmlDocument object and load the XML into
that, but I really wanted to load it into a DataSet, rather then having to
work with the DOM.

The XML returned from the WebDAV request looks like this:

<?xml version="1.0"?>
<a:multistatus xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:c="xml:" xmlns:d="urn:schemas-microsoft-com:office:office"
xmlns:a="DAV:">
<a:response>

<a:href>http://myCompany.com/exchange/Theatre/Calendar/dcxfxcvxcv.EML</a:hre
f>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<a:displayname>dcxfxcvxcv.EML</a:displayname>
</a:prop>
</a:propstat>
</a:response>
<a:response>

<a:href>http://myCompany.com/exchange/Theatre/Calendar/sdfsdfsdfsdf.EML</a:h
ref>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<a:displayname>sdfsdfsdfsdf.EML</a:displayname>
</a:prop>
</a:propstat>
</a:response>
</a:multistatus>

-----Original Message-----
From: Little, Ambrose [mailto:Click here to reveal e-mail address]
Sent: Friday, March 22, 2002 4:28 PM
To: aspngescalate
Subject: [aspngescalate] RE: NOTANSWERED BEFORE: Invalid URI Exception

Don't suppose you could show us the code that builds the "r" object?
My experience with that exception is that it was not a fully-formed URI.

--Ambrose

-----Original Message-----
From: Devin Rader [mailto:Click here to reveal e-mail address]
Sent: Friday, 22 March, 2002 15:32
To: aspngescalate
Subject: [aspngescalate] NOTANSWERED BEFORE: Invalid URI Exception

I am trying to load some XML from a WebDAV query into a dataset but keep
getting an Invalid URI exception. Heres the code:
StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);
if (IStream.Peek() > 0)

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);
Any ideas why?
Thanks
Devin
| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
Reply to this message...
 
    
Little, Ambrose
Devin,

My experience with this error is that it has a not-fully-formed URI. For
instance, if I pass a relative URL to it, it blows up. Make sure you're
passing the full URL, e.g., http://www.mysite.com/mydir/mypage.aspx
<http://www.mysite.com/mydir/mypage.aspx> .

--Ambrose

-----Original Message-----
From: Devin Rader [mailto:Click here to reveal e-mail address]
Sent: Friday, 22 March, 2002 17:17
To: aspngescalate
Subject: [aspngescalate] RE: NOTANSWERED BEFORE: Invalid URI Exception

No Problem...

Heres most of the code in the Method:

HttpWebRequest w = (HttpWebRequest)WebRequest.Create(strURL);
w.Credentials=new System.Net.NetworkCredential("User", "Password",
"DMA");
w.Method="SEARCH";
w.ContentType="text/xml";
w.ContentLength = System.Text.Encoding.ASCII.GetChars(tmp).Length;

StreamWriter s = new
StreamWriter(w.GetRequestStream(),System.Text.Encoding.ASCII);
s.Write(System.Text.Encoding.ASCII.GetChars(tmp));
s.Flush();
s.Close();

w.Accept HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT"];
w.Headers["Accept-Language"] HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"];
w.Headers.Add("depth","0");

w.Headers.Add("translate", "f");
w.Headers["Accept-Encoding"] HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_ENCODING"];
w.UserAgent HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"];

try
{
HttpWebResponse r = (HttpWebResponse)w.GetResponse();

StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);
}
catch (Exception exc)
{}

You can see that the XML is begin returned from a HttpWebRequest via an
HttpWebResponse object, and is then loaded into an StreamReader.

I have been able to create a new XmlDocument object and load the XML into
that, but I really wanted to load it into a DataSet, rather then having to
work with the DOM.

The XML returned from the WebDAV request looks like this:

<?xml version="1.0"?>
<a:multistatus xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:c="xml:" xmlns:d="urn:schemas-microsoft-com:office:office"
xmlns:a="DAV:">

<a:response>

<a:href>http://myCompany.com/exchange/Theatre/Calendar/dcxfxcvxcv.EML
<http://myCompany.com/exchange/Theatre/Calendar/dcxfxcvxcv.EML> </a:href>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<a:displayname>dcxfxcvxcv.EML</a:displayname>
</a:prop>
</a:propstat>
</a:response>
<a:response>

<a:href>http://myCompany.com/exchange/Theatre/Calendar/sdfsdfsdfsdf.EML
<http://myCompany.com/exchange/Theatre/Calendar/sdfsdfsdfsdf.EML> </a:href>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<a:displayname>sdfsdfsdfsdf.EML</a:displayname>
</a:prop>
</a:propstat>
</a:response>
</a:multistatus>

-----Original Message-----
From: Little, Ambrose [mailto:Click here to reveal e-mail address
<mailto:Click here to reveal e-mail address> ]
Sent: Friday, March 22, 2002 4:28 PM
To: aspngescalate
Subject: [aspngescalate] RE: NOTANSWERED BEFORE: Invalid URI Exception

Don't suppose you could show us the code that builds the "r" object?
My experience with that exception is that it was not a fully-formed URI.

--Ambrose

-----Original Message-----
From: Devin Rader [mailto:Click here to reveal e-mail address
<mailto:Click here to reveal e-mail address> ]
Sent: Friday, 22 March, 2002 15:32
To: aspngescalate
Subject: [aspngescalate] NOTANSWERED BEFORE: Invalid URI Exception

I am trying to load some XML from a WebDAV query into a dataset but keep
getting an Invalid URI exception. Heres the code:
StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);
if (IStream.Peek() > 0)

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);
Any ideas why?
Thanks
Devin
| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp
<http://www.asplists.com/asplists/aspngxml.asp> = JOIN/QUIT
| http://www.asplists.com/search <http://www.asplists.com/search> = SEARCH
Archives

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp
<http://www.asplists.com/asplists/aspngescalate.asp> = JOIN/QUIT
| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp
<http://www.asplists.com/asplists/aspngescalate.asp> = JOIN/QUIT

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
Reply to this message...
 
    
Devin Rader
After more experimenting, I have found that if I save the response XML to a
file, then load the DS from that file, it works.

Heres the code:

xmlDocBack.LoadXml(IStream.ReadToEnd()); //<-- Save XML TO FILE
xmlDocBack.Save("c:\\inetpub\\wwwroot\\WebDAV-WebAPP\\XMLFile3.xml");

DataSet ds = new DataSet(); //<-- LOAD XML FROM SAME FILE INTO DS
ds.ReadXml("c:\\inetpub\\wwwroot\\WebDAV-WebAPP\\XMLFile3.xml");

dgResults.DataSource = ds.Tables;
dgResults.DataBind();

Why can I not go straight to the DS without having to save?

Is there anyone out there?

Thanks!!

Devin

-----Original Message-----
From: Devin Rader [mailto:Click here to reveal e-mail address]
Sent: Friday, March 22, 2002 5:17 PM
To: aspngescalate
Subject: [aspngescalate] RE: NOTANSWERED BEFORE: Invalid URI Exception

No Problem...
Heres most of the code in the Method:
HttpWebRequest w = (HttpWebRequest)WebRequest.Create(strURL);
w.Credentials=new System.Net.NetworkCredential("User", "Password",
"DMA");
w.Method="SEARCH";
w.ContentType="text/xml";
w.ContentLength = System.Text.Encoding.ASCII.GetChars(tmp).Length;

StreamWriter s = new
StreamWriter(w.GetRequestStream(),System.Text.Encoding.ASCII);
s.Write(System.Text.Encoding.ASCII.GetChars(tmp));
s.Flush();
s.Close();

w.Accept HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT"];
w.Headers["Accept-Language"] HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"];
w.Headers.Add("depth","0");

w.Headers.Add("translate", "f");
w.Headers["Accept-Encoding"] HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_ENCODING"];
w.UserAgent HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"];

try
{
HttpWebResponse r = (HttpWebResponse)w.GetResponse();

StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);
}
catch (Exception exc)
{}
You can see that the XML is begin returned from a HttpWebRequest via an
HttpWebResponse object, and is then loaded into an StreamReader.
I have been able to create a new XmlDocument object and load the XML into
that, but I really wanted to load it into a DataSet, rather then having to
work with the DOM.
The XML returned from the WebDAV request looks like this:
<?xml version="1.0"?>
<a:multistatus xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:c="xml:" xmlns:d="urn:schemas-microsoft-com:office:office"
xmlns:a="DAV:">
<a:response>

<a:href>http://myCompany.com/exchange/Theatre/Calendar/dcxfxcvxcv.EML</a:hre
f>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<a:displayname>dcxfxcvxcv.EML</a:displayname>
</a:prop>
</a:propstat>
</a:response>
<a:response>

<a:href>http://myCompany.com/exchange/Theatre/Calendar/sdfsdfsdfsdf.EML</a:h
ref>
<a:propstat>
<a:status>HTTP/1.1 200 OK</a:status>
<a:prop>
<a:displayname>sdfsdfsdfsdf.EML</a:displayname>
</a:prop>
</a:propstat>
</a:response>
</a:multistatus>

-----Original Message-----
From: Little, Ambrose [mailto:Click here to reveal e-mail address]
Sent: Friday, March 22, 2002 4:28 PM
To: aspngescalate
Subject: [aspngescalate] RE: NOTANSWERED BEFORE: Invalid URI Exception

Don't suppose you could show us the code that builds the "r" object?
My experience with that exception is that it was not a fully-formed URI.
--Ambrose
-----Original Message-----
From: Devin Rader [mailto:Click here to reveal e-mail address]
Sent: Friday, 22 March, 2002 15:32
To: aspngescalate
Subject: [aspngescalate] NOTANSWERED BEFORE: Invalid URI Exception

I am trying to load some XML from a WebDAV query into a dataset but keep
getting an Invalid URI exception. Heres the code:
StreamReader IStream = new
StreamReader(r.GetResponseStream(),System.Text.Encoding.ASCII);
if (IStream.Peek() > 0)

ds.ReadXml(IStream.ReadToEnd(),System.Data.XmlReadMode.InferSchema);
Any ideas why?
Thanks
Devin
| [aspngxml] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngxml.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
| [aspngescalate] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT
Reply to this message...
 
 
System.Data.DataSet
System.Data.XmlReadMode
System.IO.StreamReader
System.IO.StreamWriter
System.Net.HttpWebRequest
System.Net.HttpWebResponse
System.Net.NetworkCredential
System.Net.WebRequest
System.Text.Encoding
System.Web.HttpContext
System.Xml.XmlDocument




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com