Could this work?
using (var webClient = new WebClient()) { try { Stream strm = webClient.OpenRead("http://www.episefesr.com"); } catch (WebException we) { throw we; } }
Both solutions doesn't work - when opening stream I am getting :
{"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."}
Even when page exists (efter redirects)
And when using
PermanentLinkUtility.GetContentReference(urlBuilder); or PermanentLinkUtility.GetGuid(url); I am getting null and empty Guid.
Any more ideas?
IUrlResolver urlResolver; var content = urlResolver.Route(new UrlBuilder(url));
Of course inject the IUrlResolver instance from the constructor.
UrlResolver.Current.Route(url);
should work both for simple address and hierarchichal routes. What does the url look like, is it absolute (that is which scheme and protocol)? If you run it through browser do you get a non 404 response?
Unfortunelty none of the answers are working for me. We are using https protocol and the issue is with the fact that simple adress has been set.
Marta, what do you pass in to function?
You should not pass in the absolut url I think
It should be fine to use absolute url as well but if you do the host must be listed under some site in "Manage Websites" in admin mode (to avoid routing unknown hosts like e.g. https://www.google.com/someSegmentThatMightExistInCMS)
Hi,
I have an url to a page, how can I check if this page exists?
Using UrlResolver.Current.Route(url); doesn't work - it returns null. It is probably because simple address has being set for this page.
I need to check if page exsits because I am constructing url from what editors are providing. And for same cases page doesn't exsit and then I need to provide different fallback url.
Any help or suggestions much appriciated!