Try our conversational search powered by Generative AI!

HTTP 302 redirect in GetHtmlFromPage method



I have a method that gets all the page versions of a page given the id. It then tries to obtain the HTML of each page version by using the GetHtmlFromPage() method in the PageCompareAlgorithm class.

However, sometimes the method returns the following:

<html><head><title>Object moved</title></head><body><h2>Object moved to <a href=\"%2fUtil%2flogin.aspx%3fReturnUrl%3d%252fen%252f\">here</a>.</h2></body></html>

This happens when the page status is Checked out for example, and seems to indicate some kind of access error (HTTP 302?). 

So, my question is: why is this happening and how can I obtain the HTML?

Any help would be greatly appreciated!

Jul 30, 2012 9:30

Hi William,

As you can see you are redirected to the login page, which indicates (as you say) insufficient rights. This probably happens because

1) The page has not been published and therefore is not visible for anonymous users

2) The access to that page is restricted to logged in users.

Solution would be to impersonate a user that have read rights for both scenarios. 

Jul 30, 2012 11:27

Hi Toni,

Thanks for your reply, seems like I have no other option than to impersonate a user.

Jul 30, 2012 13:21
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.