I try to get information from a partner that had protected the feed with username and password. Unfortuantly, when I try to catch the feed, I get the following error:
System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at umbraco.library.GetXmlDocumentByUrl(String Url)
No, it's working fine, when I save the XSLT file. The problem is when I try to render it up in the frontend environment. It's here I get my error.
It's like it don't get the username and password, that's needed to bring out the information from the xml. The XML itself it's placed on an external webpage, but you can connect to it if you just go write the url directly in the browsers.
I think that too, but I don't how to set up a password-protected page to test if it's there the problem is with GetXmlDocumentByUrl(). Is there any alternatives for this, so I can catch the XML in another way?
Could you help me out on this one. I don't think I understood your solution for the missing GetXmlDocumentByUrl() not picking up the username and password for a password protected Feed.
I've just tried this on a file behind a username+password - I can't see what Umbraco is sending, but it seems to not handle this scenario correct. The error suggests that the server's initial response of 401 actually means "401 Authorization Required", and that Umbraco somehow never performs the second request.
Here's a rundown of what's involved from a HTTP perspective - this was performed with http://hurl.it - pasting a URL with username + password.
You can see there's actually two requests (the first two GET sections) with each their responses...
GET /protected/movies.xml HTTP/1.1
Host: www.testsection.com
Accept: */*
GET /protected/movies.xml HTTP/1.1
Authorization: Basic ZGVzbW9uZDo0ODE1MTYyMzQy
Host: www.testsection.com
Accept: */*
<?xml version='1.0' encoding='UTF-8'?><movies><movie><title>
Star Wars Episode IV: A New Hope
</title></movie><movie><title>
Star Wars Episode V: The Empire Strikes Back
</title></movie><movie><title>
Star Wars Episode VI: Return Of The Jedi
</title></movie></movies>
I'm also having this problem, I'm trying to make it fail gracefully though rather than actually go into the password protected feed. Does anyone have any ideas? I've tried the following but it just never gets into the when, sits there until it times out, have also tried with $feedContent != 'error' with no luck!
I am having this same issue on a site I have inherited and recently upgraded to Umbraco 4.11.3. I've taken a quick look at the Umbraco Core and I think that this is down to a permissions problem due to the context under which the request is made I think.
Not sure if it helps or not but I've worked out why this is happening in my situation. The staging site I was working on has basic authentication enabled, the request is made under a different context to that which I am using to browse the site and therefore is denied access without the authentication credentials.
Password protected feed in XSLT
Hi,
I try to get information from a partner that had protected the feed with username and password. Unfortuantly, when I try to catch the feed, I get the following error:
System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at umbraco.library.GetXmlDocumentByUrl(String Url)
I have placed a following link into my xslt: http://username:[email protected]/feed?f=username&categories=x
Like this:
<xsl:variable name="feed" select="umbraco.library:GetXmlDocumentByUrl('http://username:[email protected]/feed?f=username&categories=x')"/>
When I try it directly in a browser no problem what so ever, but why do I get the 401 when tried in XSLT. What am I doing wrong here?
Kind regards,
Niels
No one here that can help me out?
Hi Niels
Is it when you save the XSLT file you get the error? Or do I misunderstand your post?
/Jan
Hi Jan,
Thanks for your reply.
No, it's working fine, when I save the XSLT file. The problem is when I try to render it up in the frontend environment. It's here I get my error.
It's like it don't get the username and password, that's needed to bring out the information from the xml. The XML itself it's placed on an external webpage, but you can connect to it if you just go write the url directly in the browsers.
/Niels
Hi Niels,
I'm guessing it's something internally in the GetXmlDocumentByUrl() function that somehow doesn't send the URL correct...
Maybe it's possible for you to put a password-protected page up somewhere that you could try to connect to and see what's sent from Umbraco?
/Chriztian
Hi Chriztian,
I think that too, but I don't how to set up a password-protected page to test if it's there the problem is with GetXmlDocumentByUrl(). Is there any alternatives for this, so I can catch the XML in another way?
BTW, sorry for the delayed answer...
/Niels
Hi Chriztian,
Could you help me out on this one. I don't think I understood your solution for the missing GetXmlDocumentByUrl() not picking up the username and password for a password protected Feed.
Kind regards
Niels
Hi Niels,
I've just tried this on a file behind a username+password - I can't see what Umbraco is sending, but it seems to not handle this scenario correct. The error suggests that the server's initial response of 401 actually means "401 Authorization Required", and that Umbraco somehow never performs the second request.
Here's a rundown of what's involved from a HTTP perspective - this was performed with http://hurl.it - pasting a URL with username + password.
You can see there's actually two requests (the first two GET sections) with each their responses...
So guess you could file a bug about this?
/Chriztian
Have you try by escaping special characters like "//,?" ?
I'm also having this problem, I'm trying to make it fail gracefully though rather than actually go into the password protected feed.
Does anyone have any ideas? I've tried the following but it just never gets into the when, sits there until it times out, have also tried with $feedContent != 'error' with no luck!
I am having this same issue on a site I have inherited and recently upgraded to Umbraco 4.11.3. I've taken a quick look at the Umbraco Core and I think that this is down to a permissions problem due to the context under which the request is made I think.
Not sure if it helps or not but I've worked out why this is happening in my situation. The staging site I was working on has basic authentication enabled, the request is made under a different context to that which I am using to browse the site and therefore is denied access without the authentication credentials.
I hope this might help.
Simon
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.